synced-interval

0.2.0 • Public • Published

Build Status

Synced Interval

A interval library which syncs automatically with the browser time.

Why

In React Apps the applications might be rendered at arbitrary times. When implementing a timer or a stop watch this might lead to a jumpy behaviour of the numbers as the Demo shows. This library solves this issue by syncing the timer with the time of the browser.

Usage

npm install synced-interval --save
import { 
  setSyncedInterval, 
  clearSyncedInterval, 
} from 'synced-interval';

const timeoutId = setSyncedInterval(() => { /* do something crazy */}, 200);
clearSyncedInterval(timeoutId);

Package Sidebar

Install

npm i synced-interval

Weekly Downloads

4

Version

0.2.0

License

ISC

Last publish

Collaborators

  • webpapaya