问题
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