Timer API that works stable in background tabs
JavaScript
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
build
test
.gitignore
.travis.yml
README.md
index.js
karma.conf.js
package.json

README.md

worker-timer

Build Status NPM Version License

Timer API that works stable in background tabs


⚠️ This module does not work in Chrome 55 or later. ⚠️


Installation

npm install worker-timer

downloads:

API

  • setInterval(callback: function, delay: number, ...params: any): number
  • clearInterval(timerId: number): void
  • setTimeout(callback: function, delay: number, ...params: any): number
  • clearTimeout(timerId: number): void

Example

Same as the native Timer API

const WorkerTimer = require("worker-timer");

let count = 0;

WorkerTimer.setInterval(() => {
  count += 1;
  console.log("count: " + count);
}, 1000);

License

MIT