Created
April 20, 2017 22:49
-
-
Save shama/7aedde9153ce8501faff0b9484192e1a to your computer and use it in GitHub Desktop.
promises wont block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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