Skip to content

Worker Kit ​

0.3.1 ​

2026-10-21

  • Fixed: chunks is also notified in a hidden tab — a 50 ms timer replaces requestAnimationFrame, which does not fire in a background tab.
  • Changed (behaviour fix): after pool.terminate(), run() / call() / map() reject with WorkerError code: 'POOL_TERMINATED' instead of silently creating new workers; tasks waiting or running at that moment reject with the same error.
  • Added: pool.restart() re-opens a terminated pool.
  • Added: npm run test:browser — a Playwright run of the cancel-yield.html demo stand in Chromium, Firefox and WebKit.
  • Verified: with about 4 ms of work between ctx.yield() calls, a loop stops after at most 2 further yield() calls in 100 of 100 attempts in all three browsers; one yield() costs about 20 µs (Chromium, Firefox) and 0.3–0.4 ms (WebKit). The implementation is unchanged.
  • Docs: affinity rules, "how often to call yield()", terminate() of a single worker versus a pool; README, site and AI reference synchronised with the code.

0.3.0 ​

2026-10-21

  • Fixed: chunks of useWorker() / useSharedWorker() is now reactive.
  • Fixed: a worker pool recovers from a crashed worker — the dead slot is removed and the queue continues on new slots.
  • Added: cancelling queued pool tasks and hardCancelOnAbort (pool option, RunOptions, WorkerMapOptions).
  • Added: ctx.yield() and ctx.throwIfAborted() for cooperative cancellation in long loops.
  • Added: per-call onProgress / onChunk in run().
  • Added: concurrency: 'parallel' | 'latest' | 'serial', isSupersededError().
  • Added: defineWorkerOperations() and typed call(name, input).
  • Added: WorkerHandlerError with code / details / cause.
  • Added: unwrap: 'shallow' | 'deep' with a dev hint for reactive proxies.
  • Added: useWorkerComputed() options worker, immediate and refresh().
  • Added: pool idleTimeout and affinity / affinityMode.