12 lines
271 B
JavaScript
12 lines
271 B
JavaScript
|
let wait = function(milliseconds) {
|
||
|
return new Promise((resolve, reject) => {
|
||
|
if (typeof(milliseconds) !== 'number') {
|
||
|
throw new Error('milleseconds not a number');
|
||
|
}
|
||
|
|
||
|
setTimeout(() => resolve("done!"), milliseconds)
|
||
|
});
|
||
|
}
|
||
|
|
||
|
module.exports = wait;
|