Function: createWorkerTransport()
function createWorkerTransport(
spec: IsolatedServiceSpec,
options: SpawnIsolatedOptions,
): IsolationTransport;Defined in: src/batteries/isolation/browser.ts:182
Build an IsolationTransport that spawns/re-spawns a real browser Worker per SpawnIsolatedOptions.worker.
Parameters
| Parameter | Type |
|---|---|
spec | IsolatedServiceSpec |
options | SpawnIsolatedOptions |
Returns
Remarks
connect() resolves the Worker (constructing it for a string | URL spec, or awaiting a WorkerResolver), wraps it in a PortLike (post → postMessage with any @nhtio/adk/batteries/isolation!transfer-marked values unwrapped into the transfer list; onMessage → addEventListener('message', ...)), and wires the worker's 'error'/'messageerror' events to the transport's onCrash handlers. terminate() calls worker.terminate(). createIsolatedService's recycle() re-enters this SAME connect() — since a resolver is invoked fresh on every call, it is the single source of Worker creation for the service's whole lifetime (every respawn goes through it, never a cached instance).