Primitives / foldkit-primitives/time
Interval
const · packages/primitives/src/time/interval.ts:28
| Args | { intervalMs: number } |
|---|---|
| Model | { running: boolean, lastAt: number | null } |
| Messages | Started, Stopped, Ticked { at: number } |
Its full type
const Interval: Bundle.Bundle<
'Interval',
{ readonly intervalMs: number },
{ readonly running: boolean; readonly lastAt: number | null },
| { readonly _tag: 'Started' }
| { readonly _tag: 'Stopped' }
| { readonly _tag: 'Ticked'; readonly at: number },
never,
never,
never,
void,
{},
{}
>A wall-clock interval as a bundle: the last tick time in the Model,
advanced by a tick stream while running. Sibling of Timer (which counts
ticks); this one records when they happened, so views can render clocks
and elapsed times. The clock is Effect's, so tests drive it with TestClock.
For a clock whose running or interval the parent's Model decides, use the
ticks entry instead.
In the guides
- Find one by the jobPrimitives / foldkit-primitives
- The mapPrimitives / foldkit-primitives
- foldkit-primitives/timePrimitives / Time
- Start with one: a timerPrimitives / Time
- ticks: a clock the Model drivesPrimitives / Time