admin管理员组文章数量:1393063
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'));
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'));
Share
Improve this question
edited Nov 10, 2017 at 5:48
Muhammad Umer
asked Nov 10, 2017 at 5:42
Muhammad UmerMuhammad Umer
18.2k24 gold badges111 silver badges176 bronze badges
0
2 Answers
Reset to default 5A possible workaround for this is to put debugger
in your .then
callback as well. This won't work in all situations but it worked for my particular case of debugging node.js scripts before they exit:
insert this into the JS code that you want to debug
debugger;
- when the debugger stops, type the following at the console prompt:
expressionReturningPromise().then( r => { console.log('done'); debugger; });
- resume script execution
The dev tools will then pause on the debugger within the .then
callback and you'll have the resolved value of your promise available for examination.
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
.
本文标签: javascriptchrome debugger promises dont resolve while pausedStack Overflow
版权声明:本文标题:javascript - chrome debugger promises dont resolve while paused? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744612051a2615716.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论