hd-utils
Version:
A handy utils for modern JS developers
15 lines (12 loc) • 436 B
TypeScript
/**
* @description a reliable way to call a callback after a certain ms time.
* @example // Usage
const controller = new AbortController();
// Create an animation callback every second:
animationInterval(1000, controller.signal, time => {
console.log('tick!', time);
});
// And to stop it:
controller.abort();
*/
export default function animationInterval(ms: number, signal: AbortSignal, callback: (time: number) => void): void;