globals
The minimal global surface installed onto a VM's global JS object.
globals
The minimal global surface installed onto a VM's global JS object.
globals.install(rt, globalObj) seeds globalThis (a self-reference), the
undefined/NaN/Infinity values, a console with log/warn/error bound to
the engine log (every line prefixed [zerojs]), Object (callable, with
Object.keys), Array (with Array.isArray), and the Error, TypeError,
RangeError, ReferenceError and SyntaxError constructors. Each error constructor
is callable with and without new; instances carry the class prototype, own
name/message/stack, and a stack captured from the interpreter's live call stack
at construction, so instanceof Error holds for every subclass. Function name and
length and prototype constructor are non-enumerable, following the realm's
enumerability model.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2strict
isObject(v: any) → boolean
| arg | type | description |
|---|---|---|
| v | any |
renderArg(rt: any, v: any) → string
Render one console argument: primitives via the realm's ToString, objects and arrays as a compact single-line form ({a: 1} / [1, 2]).
| arg | type | description |
|---|---|---|
| rt | any | |
| v | any |
joinArgs(rt: any, args: { any }) → string
| arg | type | description |
|---|---|---|
| rt | any | |
| args | { any } |
tagLines(text: string) → string
Prefix each line of a console render with the package tag before it reaches the engine log.
| arg | type | description |
|---|---|---|
| text | string |
installErrors(rt: any, globalObj: any) → void
Build the Error constructor family. Each class is callable with and without `new`; instances get the class proto, own name/message/stack, and a stack captured from the interpreter's live call stack at construction.
| arg | type | description |
|---|---|---|
| rt | any | |
| globalObj | any |
construct(_rt: any, args: { any }) → any
| arg | type | description |
|---|---|---|
| _rt | any | |
| args | { any } |
call(rt2: any, _this: any, args: { any }) → void
| arg | type | description |
|---|---|---|
| rt2 | any | |
| _this | any | |
| args | { any } |
construct(rt2: any, args: { any }, _newTarget: any) → void
| arg | type | description |
|---|---|---|
| rt2 | any | |
| args | { any } | |
| _newTarget | any |
installConsole(rt: any, globalObj: any) → void
| arg | type | description |
|---|---|---|
| rt | any | |
| globalObj | any |
method(sink: (string) → void
| arg | type | description |
|---|---|---|
| sink | (string |
call(_rt: any, _this: any, args: { any }) → void
| arg | type | description |
|---|---|---|
| _rt | any | |
| _this | any | |
| args | { any } |
isCallable(v: any) → boolean
Report whether a JS value is callable: an object carrying a native/JS call.
| arg | type | description |
|---|---|---|
| v | any |
installQueueMicrotask(rt: any, globalObj: any, loop: any) → void
Install the JS global `queueMicrotask(fn)`, which enqueues a microtask on the VM's loop that invokes `fn` with no arguments and `this` undefined. A non-callable argument throws a TypeError, matching Node's contract.
| arg | type | description |
|---|---|---|
| rt | any | |
| globalObj | any | |
| loop | any |
call(_rt: any, _this: any, args: { any }) → void
| arg | type | description |
|---|---|---|
| _rt | any | |
| _this | any | |
| args | { any } |
coerceDelay(rt: any, v: any) → number
Coerce a JS delay argument to a whole non-negative millisecond count. ToNumber runs first (per HTML's timer steps); NaN and negatives clamp to 0, matching browser and Node behaviour where a bad delay schedules for the next turn.
| arg | type | description |
|---|---|---|
| rt | any | |
| v | any |
installTimers(rt: any, globalObj: any, loop: any) → void
Install the JS timer globals `setTimeout`/`setInterval` and their `clearTimeout`/`clearInterval` cancellers onto `globalObj`, backed by the VM's loop. `setTimeout(fn, delay?, ...args)` arms a one-shot timer that invokes `fn` with `...args` and `this` undefined after `delay` ms; `setInterval` arms a repeating timer. Both return the loop's numeric id. A non-callable `fn` throws a TypeError; the delay is coerced via ToNumber with NaN/negative clamped to 0. `clearTimeout` and `clearInterval` both drop the timer of the given id and are interchangeable across one-shot and interval ids, matching the runtime reality that the two id spaces are shared.
| arg | type | description |
|---|---|---|
| rt | any | |
| globalObj | any | |
| loop | any |
armGlobal(name: string, repeating: boolean) → any
| arg | type | description |
|---|---|---|
| name | string | |
| repeating | boolean |
call(_rt: any, _this: any, args: { any }) → void
| arg | type | description |
|---|---|---|
| _rt | any | |
| _this | any | |
| args | { any } |
invoke( ) → void
canceller(name: string) → any
| arg | type | description |
|---|---|---|
| name | string |
call(_rt: any, _this: any, args: { any }) → void
| arg | type | description |
|---|---|---|
| _rt | any | |
| _this | any | |
| args | { any } |
install(rt: any, globalObj: any, loop: any) → void
Install the global surface onto `globalObj` and wire it as the JS global object so undeclared reads and top-level assignments resolve through it. The Object surface, the Array surface, Function.prototype, and the global conversion and parsing functions come from stdlib.install. `loop` is the VM's event loop, backing the asynchronous globals such as queueMicrotask.
| arg | type | description |
|---|---|---|
| rt | any | |
| globalObj | any | |
| loop | any |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
These counts cover only the parts this page shows. Problems on the parts it leaves out are not counted here.
Inside
1 problem across 1 itemagent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.