Skip to main content

createWorkerTransport

Typed RPC bridge between main thread and Web Worker. Wraps postMessage with request/response correlation, Observable API, and automatic cancellation on unsubscribe.

TypeScriptexample.ts
import { createWorkerTransport } from '@angular-helpers/worker-http/transport'

# Methods

MethodSignatureReturnsDescription
createWorkerTransportcreateWorkerTransport(config: WorkerTransportConfig): WorkerTransportWorkerTransportCreates a typed RPC transport that communicates with a Web Worker. Returns an Observable-based API for executing requests.
executeexecute(request: TRequest): Observable<TResponse>Observable<TResponse>Sends a request to the worker and returns an Observable. Unsubscribing sends a cancel message.
terminateterminate(): voidvoidCleans up all worker instances and releases resources.
LCP N/A
CLS N/A
INP N/A