npm.io
0.2.0 • Published 9 years ago

synced-interval

Licence
ISC
Version
0.2.0
Deps
0
Vulns
0
Weekly
0

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);

Keywords