1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

LibWeb: Add TextEncoder encodeInto

This commit is contained in:
Bastiaan van der Plaat 2023-10-06 07:03:44 +02:00 committed by Andreas Kling
parent f1ead552ce
commit 0104225d9b
9 changed files with 123 additions and 10 deletions

View file

@ -1,9 +1,20 @@
[Exposed=(Window,Worker)]
// https://encoding.spec.whatwg.org/#textencodercommon
interface mixin TextEncoderCommon {
readonly attribute DOMString encoding;
};
// https://encoding.spec.whatwg.org/#dictdef-textencoderencodeintoresult
dictionary TextEncoderEncodeIntoResult {
unsigned long long read;
unsigned long long written;
};
// https://encoding.spec.whatwg.org/#textencoder
[Exposed=*]
interface TextEncoder {
constructor();
[NewObject] Uint8Array encode(optional USVString input = "");
// TextEncoderEncodeIntoResult encodeInto(USVString source, [AllowShared] Uint8Array destination);
readonly attribute DOMString encoding;
TextEncoderEncodeIntoResult encodeInto(USVString source, [AllowShared] Uint8Array destination);
};
TextEncoder includes TextEncoderCommon;