chrome debugger promises dont resolve while paused?

你。 提交于 2019-12-23 10:17:24

问题


Maybe I'm not debugging promises right but basically if you stop at break point and run async code it doesnt actually finishes until you resume execution and that's a problem. Debugger allows you to quickly experiment with multiple api methods... but you cant if you resume it

debugger;
//now type the following in console
Promise.resolve().then(()=> console.log('done'));

回答1:


It doesn't execute because the function in .then is only called when the current "thread" is finished. This is the same for all asynchronous calls such as setTimeout.



来源:https://stackoverflow.com/questions/47216353/chrome-debugger-promises-dont-resolve-while-paused

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!