API reference@evolu/common › Worker

Typed, disposable worker and messaging primitives.

Core

NameDescription
BroadcastChannelTyped, disposable BroadcastChannel.
MessageChannelTyped, disposable MessageChannel.
MessagePortTyped, disposable MessagePort.
SharedWorkerTyped, disposable SharedWorker.
SharedWorkerSelfTyped self for code running inside a shared worker.
WorkerTyped, disposable Worker.
WorkerSelfTyped self for code running inside a dedicated worker.
NativeMessagePortOpaque type for platform-specific native MessagePort.
TransferableObjects whose ownership can be transferred between threads via postMessage.
WorkerDepsCommon dependencies for worker entry points.

Construction

NameDescription
CreateBroadcastChannelDepDependency wrapper for CreateBroadcastChannel.
CreateMessageChannelDepDependency wrapper for CreateMessageChannel.
CreateMessagePortDepDependency wrapper for CreateMessagePort.
CreateBroadcastChannelFactory function to create a BroadcastChannel.
CreateMessageChannelFactory function to create a MessageChannel.
CreateMessagePortFactory function to create a MessagePort from a native port.
createBroadcastChannelCreates an in-memory BroadcastChannel.
createMessageChannelCreates an in-memory MessageChannel.
createMessagePortCreates an in-memory MessagePort from a native token.
createSharedWorkerCreates an in-memory SharedWorker.
createWorkerCreates an in-memory Worker.

Testing

NameDescription
TestBroadcastChannelBroadcastChannel with disposal tracking for testing.
TestMessageChannelMessageChannel with disposal tracking for testing.
TestSharedWorkerTest SharedWorker with direct access to self and connect.
TestWorkerTest Worker with access to its paired worker-side self.
testCreateMessagePortCreates an in-memory CreateMessagePort for testing.
testCreateBroadcastChannelCreates an in-memory BroadcastChannel for testing.
testCreateMessageChannelCreates an in-memory MessageChannel for testing.
testCreateSharedWorkerCreates a connected TestSharedWorker for testing.
testCreateWorkerCreates a connected TestWorker for testing.
testWaitForWorkerMessageWaits until scheduled in-memory worker message delivery becomes idle.