Registers a listener for worker-level errors (module evaluation failure, uncaught error in the worker).
Receives the normalized error
OptionalonRegisters a listener for the worker's THREAD ENDING, however it ended —
a clean self-termination included. This is distinct from
onError, which reports a failure the worker survived long
enough to report; a worker that simply stops raises no error at all.
Optional, and its absence is load-bearing information rather than a
shortfall to work around: a host omits it when its runtime emits nothing
when a worker ends, so a consumer MUST treat absence as "this runtime
cannot tell me a worker died" and not as "no worker has died". Ask
IWorkerHost.reportsExit before spawning if the answer changes
what you configure.
Fires for a host-requested terminate() too on runtimes that implement it
that way, so a consumer that terminates deliberately must track that
itself rather than reading every exit as a crash.
Receives the exit code when the runtime reports one, and
null when it ends the worker without one
Registers a listener for messages from the worker.
Receives each message payload
Posts a structured-clonable message to the worker.
The message payload
Terminates the worker immediately.
Handle to one spawned worker thread, normalized across web
Worker(Deno/Bun) andnode:worker_threads(Node).Messages travel by structured clone. Listeners receive the message payload directly (already unwrapped from
MessageEventon web-worker runtimes).Since
0.1.0