Use a custom promisified setTimeout

This commit is contained in:
Schuyler Cebulskie
2017-11-19 13:47:04 -05:00
parent acf82f32c3
commit 26b28813a8
3 changed files with 15 additions and 5 deletions

View File

@@ -366,6 +366,18 @@ class Util {
return dec;
}
/**
* Creates a Promise that resolves after a specified duration.
* @param {number} ms How long to wait before resolving (in milliseconds)
* @returns {Promise<void>}
* @private
*/
static delayFor(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
}
}
module.exports = Util;