Skip to content

Instantly share code, notes, and snippets.



Last active May 14, 2017
What would you like to do?
Understanding Async/Await
const delay = ms => new Promise(resolve => setTimeout(resolve, ms))
async function breathe(log) {
log('Breathe in @@@')
await delay(3000)
log('Breathe out')
await delay(1000)
log('3 @@@')
await delay(1000)
log('2 @@@')
await delay(1000)
log('1 @@@')
await delay(1000)
log('Breathe in @@@')
return 'Good job!'
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.