x-time
setTimeout() with native promises
Installation
npm install x-time --save
Example
const xTime =
You can also await
the x-time promise:
await
Import in Typescript
The default import syntax of TypeScript does not work with this module because it exports a function directly. You need to use the following syntax in order to get completions:
Function: xTime(time[, value])
- time
<Number>
duration of timeout in ms - value
<any>
value to resolve the promise with
Returns a promise that gets resolved to the value when the time has passed.