17 lines
310 B
TypeScript
17 lines
310 B
TypeScript
|
'use strict';
|
||
|
|
||
|
/**
|
||
|
* Delay in an async/await function
|
||
|
*
|
||
|
* @param {integer} ms Milliseconds to delay for
|
||
|
*
|
||
|
* @returns {Promise} Promise to resolve after timeout
|
||
|
**/
|
||
|
|
||
|
function delay (ms : number) {
|
||
|
return new Promise((resolve : any) => {
|
||
|
return setTimeout(resolve, ms);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
module.exports = delay;
|