Skip to content

Instantly share code, notes, and snippets.

@shama
Created April 20, 2017 22:49
Show Gist options
  • Save shama/7aedde9153ce8501faff0b9484192e1a to your computer and use it in GitHub Desktop.
Save shama/7aedde9153ce8501faff0b9484192e1a to your computer and use it in GitHub Desktop.
promises wont block
const p = new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, 5000)
})
let interval
p.then(() => {
clearInterval(interval)
console.log('done')
})
interval = setInterval(() => {
console.log('not blocking')
}, 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment