A simple promise delay
$ npm install @zcorky/delay
const delay = require('@zcorky/delay').delay;
// import { delay } from '@zcorky/delay'; // ts or es6
function bar() {
console.log('time: ', Date.now());
}
(async () => {
bar();
await delay(100);
// Executed 100 milliseconds later
baz();
})();
- delay - Delay a promise a specified amount of time
MIT © Moeover