API reference › @evolu/common › Schedule › collectAllScheduleOutputs
function collectAllScheduleOutputs<Output, Input>(
schedule: Schedule<Output, Input>,
): Schedule<readonly Output[], Input>;
Defined in: packages/common/src/Schedule.ts:1647
Collects all outputs into an array.
Each step outputs a new snapshot containing all outputs so far. Because all outputs are retained and copied on each step, use this combinator with finite schedules.
Collecting outputs
import {
assertOk,
collectAllScheduleOutputs,
spaced,
take,
testCreateDeps,
} from "@evolu/common";
// Retain every delay produced by the finite schedule.
const collected = collectAllScheduleOutputs(take(3)(spaced("100ms")));
const step = collected(testCreateDeps());
step(undefined);
assertOk(step(undefined), [[100, 100], 100]);