precisetimeout
v1.0.1
Published
Set highly-accurate timeouts for your projects
Downloads
5
Readme
PreciseTimeout
Set highly-accurate timeouts for your projects
What is this package for?
The built-in setTimeout
is certainly not accurate after long times (over 10 minutes), and handling the imprecision is quite hard without recursion. On the other side, it is relatively easy to correct that error when it's a promisified timeout, however, util.promisify(setTimeout)
effectively returns a method that, when called, it can't be stopped (unlike the normal timeout, which can be stopped with clearTimeout
) but is easier to run.
This package allows developers to set their highly-accurate promisified timeouts that can be cancelled anytime. This package can also be used easily in TypeScript as typings are included aswell.
Note: Minimum version required is node.js
7.6.0
or newer without the flag due to the usage ofasync
/await
, however, I highly suggest to use at least node.js8.0.0
.
Downloading
Stable version:
npm i precisetimeout
Indev version:
In a command prompt in your projects folder (wherever that may be) run the following:
git clone https://github.com/kyranet/PreciseTimeout.git