aeon-scheduler
v0.3.0
Published
Scheduler implementations for Aeon reactive streams
Maintainers
Readme
aeon-scheduler
Scheduler implementations for Aeon, a denotationally-designed reactive programming library for TypeScript.
This package provides:
DefaultScheduler— production scheduler backed byperformance.now()with a binary-heap timer queue and microtask batching for zero-delay tasksVirtualScheduler— fully deterministic synchronous scheduler for tests; supportsadvance(duration),advanceTo(time),flush(),runAll()PerformanceClock,DateClock,VirtualClock— pluggable clock implementations
Installation
pnpm add aeon-core aeon-schedulerQuick Start
import { fromArray, map, observe } from "aeon-core";
import { DefaultScheduler } from "aeon-scheduler";
const scheduler = new DefaultScheduler();
await observe(
(v) => console.log(v),
map((x) => x * 2, fromArray([1, 2, 3])),
scheduler,
);
// 2, 4, 6For tests, use the VirtualScheduler to control time deterministically:
import { VirtualScheduler } from "aeon-scheduler";
const scheduler = new VirtualScheduler();
// schedule things, then advance virtual time:
scheduler.advance(toDuration(1000));Documentation
License
MIT
