Package: @effect/platform-browser
Module: BrowserWorker
Creates browser worker layers by combining the default WorkerPlatform with a spawner for Worker, SharedWorker, or MessagePort instances.
When to use
Use when you need both the browser WorkerPlatform and a Spawner from one
layer.
Details
The spawn callback receives the numeric worker id and may return a
Worker, SharedWorker, or MessagePort.
Gotchas
Scope finalization sends the worker close protocol over the port. Dedicated
workers created by spawn are not terminated by this layer.
See
layerPlatform for providing only the browser worker platformSignature
declare const layer: (spawn: (id: number) => Worker | SharedWorker | MessagePort) => Layer.Layer<Worker.WorkerPlatform | Worker.Spawner>
Since v4.0.0