/* * Copyright (c) 2021, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Web::Encoding { // https://encoding.spec.whatwg.org/#textencoder class TextEncoder final : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(TextEncoder, Bindings::PlatformObject); public: static WebIDL::ExceptionOr> construct_impl(JS::Realm&); virtual ~TextEncoder() override; JS::Uint8Array* encode(DeprecatedString const& input) const; static DeprecatedFlyString const& encoding(); protected: // https://encoding.spec.whatwg.org/#dom-textencoder explicit TextEncoder(JS::Realm&); virtual JS::ThrowCompletionOr initialize(JS::Realm&) override; }; }