<!-- https://tinyscript.tinyactors.dev/reference/web-platform/ -->
# Web platform APIs · Reference

Kind: reference. For: [Script author](https://tinyscript.tinyactors.dev/audiences/script-author.xml), [Embedder](https://tinyscript.tinyactors.dev/audiences/embedder.xml).
Voice: [Reference](https://tinyscript.tinyactors.dev/voices/reference.xml).

> Which web platform apis tinyscript compiles, and how far each works.

13 features: 4 implemented, 1 partial, 8 planned. Back to [all areas](https://tinyscript.tinyactors.dev/reference/index.md).

| Feature | Status | What works | Test |
|---|---|---|---|
| `AbortController` | planned | From the DOM standard, "Interface AbortController"; a built-in of d-web-platform, not built yet. |  |
| `AbortSignal` | planned | From the DOM standard, "Interface AbortSignal"; a built-in of d-web-platform, not built yet. |  |
| `atob` | implemented | The HTML standard's atob, by Infra's forgiving-base64 decode: ASCII whitespace is ignored, padding is optional, and text that is not base64 throws a DOMException named InvalidCharacterError. The result is a string of code units 0 to 255. Tested with the Web Platform Tests' fetch/data-urls/resources/base64.json (wpt/run.sh). | [`tests/web.js`](https://github.com/tinyactors-dev/tinyactors/blob/0c5984ec45040151fa4d9133cc0011950fbb90a0/tinyscript/tests/web.js) |
| `btoa` | implemented | The HTML standard's btoa: a string of code units 0 to 255 as base64 with padding; a code unit above 255 throws a DOMException named InvalidCharacterError. | [`tests/web.js`](https://github.com/tinyactors-dev/tinyactors/blob/0c5984ec45040151fa4d9133cc0011950fbb90a0/tinyscript/tests/web.js) |
| `DOMException` | implemented | WebIDL's DOMException: a global constructor of (message, name) whose prototype inherits Error.prototype, with the getters name, message and code (the legacy code table), @@toStringTag "DOMException", and the legacy code constants on the constructor and the prototype. An instance is a branded record (Error.isError gives true): a 128-byte record holding its name and message, and a 24-byte handle slot. The web-platform built-ins throw it: atob's and btoa's InvalidCharacterError. A DOMException is not serializable yet (structuredClone does not exist). | [`tests/web.js`](https://github.com/tinyactors-dev/tinyactors/blob/0c5984ec45040151fa4d9133cc0011950fbb90a0/tinyscript/tests/web.js) |
| `Headers` | planned | From the Fetch standard, "Headers class"; a built-in of d-web-platform, not built yet. |  |
| `Request` | planned | From the Fetch standard, "Request class"; a built-in of d-web-platform, not built yet. |  |
| `Response` | planned | From the Fetch standard, "Response class"; a built-in of d-web-platform, not built yet. |  |
| `structuredClone` | planned | From the HTML standard, "structuredClone"; a built-in of d-web-platform, not built yet. |  |
| `TextDecoder` | partial | The Encoding standard's TextDecoder for UTF-8, UTF-16LE and UTF-16BE, with the fatal and ignoreBOM options and streaming decode; every label of the standard resolves, and the other encodings are refused as unsupported, by name. Tested with the Web Platform Tests' encoding/resources/encodings.js (wpt/run.sh), whose entries for the other encodings are expected to fail. An instance is a branded record: a 136-byte record (its encoding, flags and decoder state) and a 24-byte handle slot. | [`tests/encoding.js`](https://github.com/tinyactors-dev/tinyactors/blob/0c5984ec45040151fa4d9133cc0011950fbb90a0/tinyscript/tests/encoding.js) |
| `TextEncoder` | implemented | The Encoding standard's TextEncoder: encode and encodeInto, to UTF-8, and the encoding getter, over Object.prototype with @@toStringTag "TextEncoder". An instance is a branded record with no state of its own: a 112-byte record and a 24-byte handle slot. | [`tests/encoding.js`](https://github.com/tinyactors-dev/tinyactors/blob/0c5984ec45040151fa4d9133cc0011950fbb90a0/tinyscript/tests/encoding.js) |
| `URL` | planned | From the URL standard, "URL class"; a built-in of d-web-platform, not built yet. |  |
| `URLSearchParams` | planned | From the URL standard, "Interface URLSearchParams"; a built-in of d-web-platform, not built yet. |  |

At tinyscript commit [`0c5984ec`](https://github.com/tinyactors-dev/tinyactors/tree/0c5984ec45040151fa4d9133cc0011950fbb90a0/tinyscript); each test is a program that runs the feature.
