Primitives / foldkit-primitives/time

ticks

function · packages/primitives/src/time/ticks.ts:26

function ticks<Model, Message>(config: {
  readonly intervalMs: (model: Model) => Option.Option<number>
  readonly onTick: (at: number) => Message
}): Subscription.Subscription<Model, Message, TickDependencies>

Ticks while intervalMs answers Some, each tick one interval after the last and the first one interval after starting. A changed interval applies from the next tick, with no restart; other Model changes do nothing.