1.0.4 • Published 2 years ago
custom-timeouts v1.0.4
Custom timeouts
With this package you will be able to call functions that will perform a timeout with a promise, giving you the option
to easily use await
on those functions.
To install the package, run the following on your machine:
npm i custom-timeouts
Then, to use the package, simply import it to your file:
const timeouts = require('custom-timeouts');
Then, use one of the following available functions: milliseconds()
, seconds()
, minutes()
, hours()
.
For example, we can see the usage on the seconds()
function in the following code snippet:
const timeouts = require('custom-timeouts');
const myWaitingFunc = async () => {
await timeouts.seconds(3)
};
myWaitingFunc();
You can also destructure the module for the desired function:
const {seconds} = require('custom-timeouts');