workers/host/bootHandshake
@arolariu/website / workers/host/bootHandshake
workers/host/bootHandshake
Fileoverview
Two-channel bootstrap handshake for the Web Worker host.
Remarks
Owns: building the rpc + event MessageChannel pair, posting the
bootstrap message with both ports transferred, attaching the bootstrap-
timeout, swapping the event-port listener to steady-state mode after
{kind: "ready"} arrives, and exposing a teardown() that closes both
parent ports and clears the timeout.
Intentionally NOT owned by this helper:
- Lifecycle state transitions (
bootBegin,bootComplete,crash). The host owns the lifecycle and decides what each handshake outcome means; e.g., a "rejected during boot" outcome may map to eitherWorkerCrashError(timeout) orWorkerDeadError(host disposed during boot) depending on host-level state the helper does not see. - Worker
errorevent listening. The host attaches that listener BEFORE constructing the handshake so anerrorarriving during boot still triggers the host'shandleCrash()path. - Comlink wrapping. Callers wrap
parentRpcPortthemselves oncereadyresolves.
Type Aliases
Functions
// was this page useful?