requestanimationframe-timer
v3.0.3
Published
setTimeout and setInterval by using requestAnimationFrame
Downloads
35,056
Maintainers
Readme
npm install --save-dev requestanimationframe-timer
import { setInterval, setTimeout, clearInterval, clearTimeout } from 'requestanimationframe-timer';
const id_1 = setTimeout((a) => console.log(a), 1000, '1000 ms timeout');
const id_2 = setInterval((a) => console.log(a), 2000, '2000 ms interval');
setTimeout(() => {
clearTimeout(id_1);
clearInterval(id_2);
}, 10000);