driftless
Version:
Driftless setInterval and setTimeout replacement for Node and the browser
27 lines (19 loc) • 705 B
Markdown
# `driftless` [](https://travis-ci.org/dbkaplun/driftless)
Driftless setInterval and setTimeout replacement for Node and the browser
[](https://asciinema.org/a/183890)
## Usage
```
npm install driftless
```
```js
import {
setDriftlessTimeout,
setDriftlessInterval,
clearDriftless,
} from 'driftless';
// Use like setTimeout and setInterval
```
## How it works
`driftless` repeatedly calls setTimeout in advance of the requested timeout for
greater accuracy. It does this recursively, until the timeout is reached within
a given threshold.