Primitives / Time
foldkit-primitives/time
What the clock said last: a count of ticks, when the last one was, a value that
settled after the typing stopped. Everything here runs on Effect's clock, so a
test advances it with TestClock.adjust instead of waiting.
(source)
| Name | Form | Model | Messages | Args |
|---|---|---|---|---|
Timer | bundle | { count, running } | Started, Stopped, Ticked | { intervalMs } |
Interval | bundle | { running, lastAt } | Started, Stopped, Ticked { at } | { intervalMs } |
ticks({ intervalMs, onTick }) | entry | your Message | ||
debounce({ name, value }) | bundle factory | { latest, generation } | Changed { value }; out: Debounced { value } | { delayMs } + onOut |
Throttle | bundle | { lastAt } | Attempted (and its own Evaluated { now }); out: Throttled { at } | { intervalMs } + onOut |
formatRelativeTime(from, to, locale?) | function |