worker-timer

Timer API that works stable in background tabs

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
worker-timer
1401.1.07 years ago8 years agoMinified + gzip package size for worker-timer in KB

Readme

worker-timer
Build Status NPM Version License
Timer API that works stable in background tabs

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