BrowserWorkerRunner.ts
BrowserWorkerRunner.ts overview
Section titled “BrowserWorkerRunner.ts overview”Runner-side browser platform for Effect worker handlers.
make builds a WorkerRunnerPlatform over a MessagePort or Window.
layer provides the platform from the global worker self, and
layerMessagePort provides it from an explicit endpoint. The platform
receives parent or client messages, runs Effect handlers, and posts responses
back through the browser messaging channel.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”constructors
Section titled “constructors”Creates a WorkerRunnerPlatform service that runs worker handlers over a MessagePort or Window.
Signature
declare const make: (self: MessagePort | Window) => WorkerRunner.WorkerRunnerPlatform["Service"]Since v4.0.0
layers
Section titled “layers”Layer that provides a browser WorkerRunnerPlatform using the global self worker context.
When to use
Use when you need a browser worker entry point to use the ambient self
object as the worker transport.
Details
Delegates to make(self) and provides the runner-side platform used by
protocols such as RpcServer.layerProtocolWorkerRunner.
Gotchas
This layer depends on the browser worker global self. Use
layerMessagePort when the transport is an explicit MessagePort or
Window.
See
makefor constructing a runner platform from an explicit endpointlayerMessagePortfor providing a platform from an explicit endpoint
Signature
declare const layer: Layer.Layer<WorkerRunner.WorkerRunnerPlatform, never, never>Since v4.0.0
layerMessagePort
Section titled “layerMessagePort”Layer that provides a WorkerRunnerPlatform using the supplied MessagePort or Window.
Signature
declare const layerMessagePort: (port: MessagePort | Window) => Layer.Layer<WorkerRunner.WorkerRunnerPlatform>Since v4.0.0