-
-
Notifications
You must be signed in to change notification settings - Fork 0
Release notes
Eugene Lazutkin edited this page May 7, 2026
·
2 revisions
Bare import 'time-queues' now works at runtime — added an index.js barrel and a "." entry in package.json#exports. New Scheduler.onError hook and MicroTask.cancelError for richer task lifecycle control. Several user-observable bug fixes. Adopted js-check (dual-tsconfig pattern) for unused-vars / undeclared-refs / control-flow checks without ESLint's transitive-dep cost.
-
Bare imports:
import * as pkg from 'time-queues';(orimport {sleep, Scheduler, ...} from 'time-queues';) now resolves at runtime. Subpath imports (time-queues/sleep.jsetc.) continue to work unchanged. -
Scheduler.onError: optional callback(error, task) => voidinvoked when a scheduledtask.fnthrows. Defaultnull; if unset, exceptions surface via unhandled rejection. Either way, the scheduler loop continues — one failing task no longer stalls the rest. -
MicroTask.cancelError: read-only getter exposing the error supplied to the firstcancel(error)call, ornull. Useful for inspecting why a non-promised task was canceled. -
MicroTaskcancel/resolve hardening:resolve()now throws if called beforemakePromise()(was a silent no-op that hung subscribers).cancel(error)stores the error and replays it on a latermakePromise()— the freshly-created promise settles immediately asCancelTaskError(cause: error).
-
whenLoaded.remove(fn)andwhenDomLoaded.remove(fn): actual list-toolkit method isgetNodeIterator, notgetNodeIterable— both functions previously crashed at runtime. -
Scheduler.repeat(0): no longer infinite-loops the scheduler. Next-delay computation clamps to ≥1ms. -
PageWatcher: can be safely imported in Node now. The module-level singleton'sgetState()previously crashed withReferenceError: document is not definedoutside DOM. -
Retainer.get()race: concurrentget()calls before the firstcreate()resolves now share the same in-flight promise —create()runs at most once per zero-counter interval. -
Retainer.release(): deferred destroy errors no longer silently swallowed; surface as standard unhandled rejection events (consistent with theimmediatelypath). -
random-dist.normal()skewness: skew-normal computation now uses two N(0,1) samples (the second from Box-Muller'ssinarm) instead of mixing the uniformv. The previous output didn't correspond to a recognized statistical distribution.
-
js-checkadopted viatsconfig.check.json+npm run js-checkscript (also wired into CI). 30 → 0 errors after fixing the typo bugs and tightening sidecars. -
Fleet alignment: HTTPS submodule URLs, CI Node matrix
[22, 24, 26],engines.node: ">=22", paired.claude/commands/workflow files, tuned.github/dependabot.yml(grouped +versioning-strategy: increase-if-necessary). -
JSDoc stripped from
.jssource files;// @ts-self-typesdirectives in place..d.tsis the sole source of truth for types + docs.
-
ListQueue.list: List<MicroTask>andScheduler.queue: MinHeap<Task>fields now declared (instance fields visible to consumers). -
Retainer.valueis nowreadonly. -
Counter.notify()method declared (called by setter / increment / decrement / advance — and by user when mutatingcountdirectly). -
processTasks()declared onFrameQueue,IdleQueue,Scheduler(the timer callbacks). - Internal handles privatized (
Throttler.#handle,Retainer.#handle,Retainer.#creating). -
LimitedQueue.wrapstatic helper → module-private function. -
MicroTaskQueue.returnArgsstatic → module-private.
- Hoisted
_drainBatch(batchMs, taskContext)helper toListQueue;FrameQueueandIdleQueueshare it (-32 lines across the two subclasses). -
MicroTaskQueue.schedule()argument shadowing cleaned up (outerscheduleArgs, innerinvocationArgs).
- 103 → 112 tests; 668 → 733 asserts cross-runtime (Node, Bun, Deno).
- New tests for: bare-import barrel surface,
Counter.notify()direct-mutation flow,Retainerconcurrent gets,Scheduler.repeat(0)clamp,ScheduleronError handling,MicroTaskresolve/cancel error paths.
- Wiki: refreshed
Scheduler,MicroTask,Retainer,Throttlerpages for the new API surface and the pacing-vs-throttle reframing onThrottler(rate-limiting / pacing semantics, not classical throttle — every call is honored, none are dropped). -
ARCHITECTURE.md: updated for new structures and helpers. -
llms.txt/llms-full.txt: regenerated against current API.
Bug fixes, improved TypeScript declarations, expanded test coverage, and documentation corrections.
-
Scheduler:
processTasks()now skips canceled tasks instead of executing them. -
Scheduler:
dequeue()guards against already-removed tasks. -
Scheduler:
repeat()stops re-enqueueing whentask.isCanceledis set. -
LimitedQueue: Constructor now validates the
limitparameter (appliesMath.max(1, limit)). -
PageWatcher:
pause()no longer calls deadsuper.pause()path; event listeners are removed correctly. -
PageWatcher:
clear()now cancels tasks likeListQueuedoes. -
Retainer:
release()wrapsdestroy()in try/catch to prevent unhandled rejections.
-
LimitedQueue.d.ts:
enqueueandschedulecallbacks now correctly include{task, queue}argument. - Various
.d.tsfiles refined for accuracy: Scheduler, FrameQueue, IdleQueue, ListQueue, MicroTask, MicroTaskQueue, PageWatcher, Throttler, Counter, index, random-dist, random-sleep.
- Added CommonJS test (
test-cjs.cjs). - Added many new unit tests for Counter, LimitedQueue, ListQueue, Retainer, Scheduler, Throttler, random-dist.
- Added TypeScript typing tests for CancelTaskError, MicroTask, LimitedQueue, and browser types.
- Fixed
ARCHITECTURE.md: correctedwhenDomLoaded/whenLoadedexport descriptions, fixed GitHub URLs. - Fixed
wiki/whenLoaded().md: corrected description (page load, not DOM load). - Fixed
wiki/Counter.md: removed incorrect LimitedQueue/Counter association. - Updated
wiki/Scheduler.md: documentedrepeat()cancellation behavior. - Updated file layout in AGENTS.md and rule files to include
.mjs/.cjstest patterns.