Skip to main content

init

Function init 

Source
pub fn init(ctx: &Ctx<'_>) -> Result<()>
Expand description

Install every web-standard global on ctx: DOMException, Event / EventTarget, AbortController / AbortSignal, the full Streams surface, Buffer / Blob / File, crypto, the text codecs, URL / URLSearchParams, atob / btoa, structuredClone, performance, FormData, the compression streams and navigator.

One entry point, so a host cannot install half the crate. What is deliberately NOT here: the timers (they carry host state, see web::timers), process (its env and cwd are the host’s to supply, see node::process), the Node modules (served through modules::modules by the host’s loader) and an fs global (Node has none; fs::init is the opt-in).