/* * 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 : public RefCounted , public Bindings::Wrappable { public: using WrapperType = Bindings::TextEncoderWrapper; static NonnullRefPtr create() { return adopt_ref(*new TextEncoder()); } static NonnullRefPtr create_with_global_object(Bindings::WindowObject&) { return TextEncoder::create(); } JS::Uint8Array* encode(String const& input) const; static FlyString const& encoding(); protected: // https://encoding.spec.whatwg.org/#dom-textencoder TextEncoder() = default; }; }