Skip to main content

workers/host/workerLifecycle

@arolariu/website


@arolariu/website / workers/host/workerLifecycle

workers/host/workerLifecycle

Fileoverview

State machine, idle timer, and in-flight tracker for a worker host.

Remarks

Pure logic — no Worker, no Comlink. createWorkerHost glues this to the transport. Tests use fake timers to drive idle scheduling deterministically.

State semantics: see spec §6.1. The ready state is the only one accepting calls; idle/starting queue work; dead/disposed reject it.

Lazy reboot: when the idle timer fires we call onIdle but do not change the public state — createWorkerHost silently disposes the worker and lazy-reboots on the next call.

Type Aliases

Functions

// was this page useful?