Skip to content
filedom
Esc
↑↓navigate↵open⌘Jpreview
On this page

useFixedTick

Runs a callback at a fixed interval.

import { useFixedTick } from 'filedom';

useFixedTick(() => step(), 120, playing);

Parameters

useFixedTick(
  callback: () => void,
  ms: number,
  enabled?: boolean
)

callback: tick handler. Each tick calls the latest closure, and a new closure does not restart the interval.

ms: interval in milliseconds. Changing it restarts the interval.

enabled: whether the timer runs. Default true. Set it to false to pause without unmounting.

Returns

Nothing (void).

Was this page helpful?