mohayonao / worker-timer

Timer API that works stable in background tabs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Timer API that works stable in background tabs


Languages

Language:JavaScript 100.0%