@kev_nz/async-tools
Version:
Async tools - a collection of utility functions for working with async/await code.
14 lines (13 loc) • 333 B
JavaScript
/**
* Executes an async functions that will provide a
* delay for the amount of time passed in
*
* @async
* @function delay
* @param {number} time - The duration in milliseconds
* @example
* // wait 20 milliseconds
* await delay(20)
*/
module.exports = time =>
new Promise(resolve => setTimeout(() => resolve(), time))