setInterval + requestIdleCallback function
Install with npm:
npm install requestidleinterval
Example: Do task per 1000ms
import { requestIdleInterval } from "requestidleinterval";
const cancel = requestIdleInterval(() => {
// Do interval task
}, {
// interval msec
interval: 1000,
// if the enviroment is busy, the delay msec to do interval task
timeout: 500
});
// if you want to cancel interval task
cancel();
See Releases page.
Install devDependencies and Run npm test
:
npm test
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
MIT © azu