API reference › @evolu/common › Schedule › windowed
function windowed(interval: Duration): Schedule<number>;
Defined in: packages/common/src/Schedule.ts:382
Divides the timeline into fixed windows and sleeps until the next boundary.
Similar to fixed, but always sleeps until the next window boundary regardless of when the last execution started. Outputs the repetition count.
Useful for aligning executions to regular intervals from the start time.
Example
// Execute at regular 5-second boundaries from start
const aligned = windowed("5s");
// If elapsed is 3s, waits 2s. If elapsed is 7s, waits 3s.