Worker Kit
0.3.1
2026-10-21
- Fixed:
chunksis also notified in a hidden tab — a 50 ms timer replacesrequestAnimationFrame, which does not fire in a background tab. - Changed (behaviour fix): after
pool.terminate(),run()/call()/map()reject withWorkerErrorcode: '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 thecancel-yield.htmldemo stand in Chromium, Firefox and WebKit. - Verified: with about 4 ms of work between
ctx.yield()calls, a loop stops after at most 2 furtheryield()calls in 100 of 100 attempts in all three browsers; oneyield()costs about 20 µs (Chromium, Firefox) and 0.3–0.4 ms (WebKit). The implementation is unchanged. - Docs:
affinityrules, "how often to callyield()",terminate()of a single worker versus a pool; README, site and AI reference synchronised with the code.
0.3.0
2026-10-21
- Fixed:
chunksofuseWorker()/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()andctx.throwIfAborted()for cooperative cancellation in long loops. - Added: per-call
onProgress/onChunkinrun(). - Added:
concurrency: 'parallel' | 'latest' | 'serial',isSupersededError(). - Added:
defineWorkerOperations()and typedcall(name, input). - Added:
WorkerHandlerErrorwithcode/details/cause. - Added:
unwrap: 'shallow' | 'deep'with a dev hint for reactive proxies. - Added:
useWorkerComputed()optionsworker,immediateandrefresh(). - Added: pool
idleTimeoutandaffinity/affinityMode.