Skip to content

azu/requestidleinterval

Repository files navigation

requestidleinterval Build Status

setInterval + requestIdleCallback function

Install

Install with npm:

npm install requestidleinterval

Usage

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

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu

Releases

No releases published

Sponsor this project

 

Packages

No packages published