async-await

Do Javascript promises block the stack

强颜欢笑 提交于 2020-11-24 16:53:15
问题 When using Javascript promises, does the event loop get blocked? My understanding is that using await & async, makes the stack stop until the operation has completed. Does it do this by blocking the stack or does it act similar to a callback and pass of the process to an API of sorts? 回答1: When using Javascript promises, does the event loop get blocked? No. Promises are only an event notification system. They aren't an operation themselves. They simply respond to being resolved or rejected by