Skip to main content

workers/runtime/exposeWorker

@arolariu/website


@arolariu/website / workers/runtime/exposeWorker

workers/runtime/exposeWorker

Fileoverview​

Worker-side runtime: exposes a typed API once the bootstrap handshake completes.

Remarks​

Mirrors createWorkerHost from the parent side. Handles the bootstrap handshake, normalizes thrown errors so the parent wrapper can rewrap them as WorkerError, and emits {kind: "ready"} on the event port to signal readiness to the host.

Handshake state lives in a per-expose() WorkerRuntime object; the module-level activeRuntime pointer is updated on each successful bootstrap so getEventPort() / getBootstrapCapabilities() continue to work as zero-argument helpers. __resetForTesting() clears the pointer.

Type Aliases​

Functions​

// was this page useful?