Skip to content

handleJobs

handleJobs<TIn, TOut>(fn): void

Defined in: src/modules/worker-pool/worker-pool.ts:119

Worker-side counterpart to WorkerPool: wires the message protocol so the worker script only supplies the job function. Handles both sync and async jobs and reports thrown errors back to the pool (rejecting the Promise).

TIn

TOut

(input) => TOut | Promise<TOut>

void

job.worker.ts
handleJobs((input: MyInput) => heavyCompute(input));