UNPKG

timeout-flow

Version:

Fluent, composable, pauseable JavaScript timers and time control flows — plus RAF utilities for frame-based logic.

12 lines (11 loc) 553 B
/** * Repeats a function every N milliseconds using requestAnimationFrame * (instead of setTimeout/setInterval). * * @param {string|number} duration - Interval duration ("1s", "500ms", 500, etc.) * @param {Function} fn - Function to run * @param {number} [maxTimes=Infinity] - Max number of executions * @param {boolean} [runImmediately=false] - Whether to run immediately * @returns {Object} - Control methods and flags */ export function everyRaf(duration: string | number, fn: Function, maxTimes?: number, runImmediately?: boolean): Object;