【发布时间】:2018-07-27 12:07:01
【问题描述】:
我的角度模板我使用以下组件:
<building-selection
(done)="sendToBackend($event)"
>
</building-selection>
这个组件向用户显示带有复选框的建筑物图像,当他完成检查时,它会发出带有所选建筑物的数组的事件
在打字稿代码中,以下功能起作用:
public async sendToBackend(buildings)
{
console.log({buildings});
debugger; // I see buildings "debugger variable preview"
...
}
但如果我注释掉 console.log 然后在“调试器变量
预览”我看到消息(如果我们有非异步功能则不会出现这种现象):
ReferenceError:建筑物未在 eval 处定义(eval at (http://project.localhost:3003/main.bundle.js:53596:17), :1:1) 在 ClientProjectEditorComponent。
...调用任务 (http://project.localhost:3003/polyfills.bundle.js:14037:14)↵ 在 HTMLUnknownElement.globalZoneAwareCallback (http://project.localhost:3003/polyfills.bundle.js:14063:17)" 原型 : 错误
问题:当console 语句被注释掉时,为什么debugger 关键字的作用不同?
【问题讨论】:
标签: google-chrome typescript async-await javascript-debugger