Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dbkaplun/driftless
Driftless setInterval and setTimeout replacement for Node and the browser
https://github.com/dbkaplun/driftless
accurate drift precise setinterval settimeout
Last synced: 20 days ago
JSON representation
Driftless setInterval and setTimeout replacement for Node and the browser
- Host: GitHub
- URL: https://github.com/dbkaplun/driftless
- Owner: dbkaplun
- License: mit
- Created: 2014-04-05T03:24:00.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T17:30:03.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T13:15:18.599Z (7 months ago)
- Topics: accurate, drift, precise, setinterval, settimeout
- Language: JavaScript
- Homepage:
- Size: 3.42 MB
- Stars: 79
- Watchers: 7
- Forks: 11
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `driftless` [![Build Status](https://travis-ci.org/dbkaplun/driftless.svg?branch=master)](https://travis-ci.org/dbkaplun/driftless)
Driftless setInterval and setTimeout replacement for Node and the browser
[![comparison](https://github.com/dbkaplun/driftless/raw/master/comparison.gif)](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.