Skip to content

RAF

Bindings for @solid-primitives/raf.

FrameRequestCallback

type FrameRequestCallback = float -> unit

createRAF

let createRAF(
    callback: FrameRequestCallback
    ): running: Accessor<bool> * start: VoidFunction * stop: VoidFunction
ParamDesc
callbackThe callback to run on each frame.
ReturnsDesc
runningSignal of whether it is running.
startStarts the loop.
stopStops the loop.

A reactive window.requestAnimationFrame loop that is disposed automatically when its owner is cleaned up.

targetFPS

let targetFPS(
    callback: FrameRequestCallback,
    fps: float | Accessor<float>
    ): FrameRequestCallback

Caps a frame callback at fps frames per second by skipping frames, so frame durations can be uneven.

createMs

let createMs(
    fps: float | Accessor<float>,
    ?limit: float | Accessor<float>
    ): MsCounter

A signal that counts up milliseconds at a given frame rate, to base animations on.

MsCounter

type MsCounter = interface
MemberDesc
current: intThe current value. Compiles to msCounter().
reset(): unitResets the counter.
running(): boolWhether the counter is running.
start(): unitRestarts the counter if it is stopped.
stop(): unitStops the counter if it is running.
Edit this page