Skip to content

setInterval and clearInterval implementation with using Web-Workers to keep up and running on inactive tabs for Chrome, Firefox and IE

License

Notifications You must be signed in to change notification settings

gorkemcnr/worker-interval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

worker-interval

setInterval and clearInterval implementation with using Web-Workers to keep up and running on inactive tabs for Chrome, Firefox and IE

Motivation

Most of the modern browsers (Chrome, Firefox and IE), intervals are clamped to fire no more often than once per second in inactive tabs. For that reason, decided to implement a library to avoid throttling on timers.

Getting Started

npm install worker-interval

Example

import * as workerInterval from 'worker-interval';

// setInterval
const intervalId = workerInterval.setInterval(/*function*/, 1000);

// clearInterval
workerInterval.clearInterval(intervalId);

About

setInterval and clearInterval implementation with using Web-Workers to keep up and running on inactive tabs for Chrome, Firefox and IE

Resources

License

Stars

Watchers

Forks

Packages

No packages published