{ } qjs-modules

globals

Source: lib/globals.js — qjsm only; imported by node, which qjsm loads at startup (off with -N)

Installs the web and Node globals QuickJS lacks. A global that already exists is never replaced. Importing the module is the whole API.

import 'globals';

new URL('https://example.com/a?x=1').searchParams.get('x'); // '1'
structuredClone({ d: new Date(0) });
GlobalSource
URL, URLSearchParamsurl
TextEncoder, TextDecodertextcode
AbortController, AbortSignalabort
EventTargetevents
Blobblob
ReadableStream, WritableStream, TransformStream, their readers, writers and controllers, *QueuingStrategy, TextEncoderStream, TextDecoderStreamstreams (the full WHATWG classes of lib/stream.js, with pipeTo()/pipeThrough()); Blob.prototype.stream() returns the same class
setTimeout, setInterval, setImmediate and their clear*timers
performance, Performance, PerformanceEntry, PerformanceMark, PerformanceMeasure, PerformanceObserver, PerformanceObserverEntryListperf_hooks
atob, btoahere (Latin-1 strings, padding optional, InvalidCharacterError)
queueMicrotaskhere (a promise job)
structuredClonehere: Date, RegExp, boxed primitives, ArrayBuffer, typed arrays, Map, Set, Error, cycles; transfer option (ArrayBuffers); SharedArrayBuffer returned as is; DataCloneError for functions, symbols, Promise, WeakMap, WeakSet, WeakRef; TypeError without arguments; the error is a plain Error, not a DOMException
cryptohere: getRandomValues() and randomUUID() from /dev/urandom; no subtle
Intlintl (English only)

Not installed: Buffer, Worker, fetch (see qjs-lws).

Exports

ExportKindDescription
structuredClone(value, options?)functionThe same function that is installed as a global.

Export list

Generated by utilities/doc-api.js from the globals dump of utilities/api-surface.sh: 1 members. Edit the text above this block, not the block.

Functions: structuredClone()