Skip to content

Function: processLockWorkerOptions()

processLockWorkerOptions(options?): WorkerOptions

Add the coordinator port to a Worker’s options so the worker can lock immediately - during module initialization, before any message is handled.

Preserves the caller’s workerData and transferList; the port is transferred, as MessagePort cannot be cloned.

WorkerOptions = {}

WorkerOptions

new Worker(url, processLockWorkerOptions({ workerData: { tenant } }));