Skip to content

Timer

Bindings for @solid-primitives/timer.

IntervalOrTimeout

type IntervalOrTimeout = (unit -> unit) -> int -> int

makeTimer

let makeTimer(
    callback: unit -> unit,
    timespan: int,
    policy: IntervalOrTimeout
    ): DisposeCallback

A timer that is cleaned up with its owner. policy is setInterval or setTimeout.

createTimer

let createTimer(
    callback: unit -> unit,
    timespan: int | Accessor<U2<bool, int>> | Accessor<bool> | Accessor<int>,
    policy: IntervalOrTimeout
    ): unit

makeTimer with a fully reactive delay. Set the delay to false to turn the timer off.

createTimeoutLoop

let createTimeoutLoop(
    callback: unit -> unit,
    timespan: int | Accessor<int>
    ): unit

Like an interval made with createTimer, but a new delay only takes effect after the callback runs.

createPolled

let createPolled(
    callback: unit -> 'T,
    timespan: int | Accessor<int>
    ): Accessor<'T>

Calls callback periodically and returns an accessor of its latest result.

createIntervalCounter

let createIntervalCounter(timespan: int | Accessor<int>): Accessor<int>

A counter that goes up by one on each interval.

Edit this page