NodeWorker.ts
NodeWorker.ts overview
Section titled “NodeWorker.ts overview”Parent-side Node.js support for Effect workers.
layerPlatform installs the WorkerPlatform used by a Node program that
owns workers. It supports both node:worker_threads workers and IPC-enabled
child processes, routing messages through Effect’s worker protocol. layer
combines that platform with a Spawner callback, and the platform asks
workers to close on scope finalization before forcefully terminating them on
timeout.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”layers
Section titled “layers”Provides the Node WorkerPlatform together with a Worker.Spawner created
from the supplied worker or child-process spawning function.
Signature
declare const layer: ( spawn: (id: number) => WorkerThreads.Worker | ChildProcess.ChildProcess) => Layer.Layer<Worker.WorkerPlatform | Worker.Spawner>Since v4.0.0
layerPlatform
Section titled “layerPlatform”Provides the Node WorkerPlatform for worker_threads workers and child
process workers, wiring messages, errors, and exits into Effect workers and
terminating the worker if graceful shutdown times out.
Signature
declare const layerPlatform: Layer.Layer<Worker.WorkerPlatform, never, never>Since v4.0.0