Skip to content

Instantly share code, notes, and snippets.



Created Apr 14, 2019
What would you like to do?
Promisified setTimeout
// Promisified setTimeout
const delay = (duration = 0) =>
new Promise(resolve =>
setTimeout(() => {
}, duration)
// Usage
async function myFunction() {
console.log('Do something');
await delay();
console.log('Do something else');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.