Reference
Web APIs
The browser-like globals extensions have, and how they differ.
Extensions run on JavaScriptCore. All of modern JavaScript is there (async/await, Map, Intl, Array.prototype.at…); of the browser and Node APIs, only these are provided.
| API | Note |
|---|---|
fetch, Headers, Response | HTTPS and network: domains only. RequestInit: method, headers, body, timeout. Response: text(), json(), arrayBuffer(), bytes(); no streams |
URL, URLSearchParams | |
TextEncoder, TextDecoder | UTF-8 only |
atob, btoa | |
setTimeout, setInterval, clearTimeout, clearInterval | 200 at most; intervals of 50 ms at least |
queueMicrotask | |
structuredClone | JSON only: dates become strings, Map and functions are lost |
performance.now() | Never goes backwards |
crypto.randomUUID(), crypto.getRandomValues() | No crypto.subtle |
console.log/info/debug/warn/error | 200 lines per 10 s, 2000 characters a line |
How fetch differs
- No cookies, cache,
credentials,modeorsignal. Usetimeoutto give up (1000–60000 ms, default 15000). body: a string is sent as is,URLSearchParamsas a form, other values as JSON.- 4xx/5xx don't throw; check
res.ok. - Errors are
NetworkError,TimeoutErrorandPermissionError.
Console
console output shows in Settings › Developer › Log and in the adanotch dev terminal. Objects are written as JSON. Error stacks go through the source map and read src/index.ts:12:5.
What isn't there
window, document, the DOM, localStorage (use ctx.storage), WebSocket, EventSource, Worker, require, process, Buffer, fs. npm packages that rely on them won't work; plain JavaScript packages (like date-fns or zod) do.