npm

requestanimationframe-timer
TypeScript icon, indicating that this package has built-in type declarations

3.0.3 • Public • Published

requestanimationframe-timer

setTimeout and setInterval by using requestAnimationFrame

Install

npm install --save-dev requestanimationframe-timer

Usage

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);

Maintainers


Chua Kang Ming

Package Sidebar

Install

npm i requestanimationframe-timer

Weekly Downloads

6,080

Version

3.0.3

License

ISC

Unpacked Size

19.7 kB

Total Files

10

Last publish

Collaborators

  • kambing86