作者:海啸1203_902 | 来源:互联网 | 2023-05-16 19:03
Workingthroughsomeeventroutingrightnowandtheresalotofdebuggingsteps.现在正在处理一些事件路由,并且有很
Working through some event routing right now and there's a lot of debugging steps.
现在正在处理一些事件路由,并且有很多调试步骤。
I know about using "debugger" in the Javascript and putting that after a conditional, and that is useful. I also know about right clicking a break point to add a test expression which is even better. However... I have no idea where this thing is going to take me and I am starting to wear out my function keys. Is there any way to add a breakpoint to a watch expression?
我知道在Javascript中使用“debugger”并将其置于条件之后,这很有用。我也知道右键单击一个断点来添加一个更好的测试表达式。但是......我不知道这件事会带给我什么,我开始磨损我的功能键。有没有办法在监视表达式中添加断点?
Basically the idea is this, within the enclosure scope, I want to check for a variable called "this.id". If this.id is the value I want, I enter the debugger.
基本上这个想法是这样的,在封装范围内,我想检查一个名为“this.id”的变量。如果this.id是我想要的值,我进入调试器。
Any ideas?
Thanks
Wanted to add that Didier's answer below solved my problem as they outlined in the article for decorating "Function". This will most likely be the path of least resistance for searching all functions for the value I want.
想要补充说下面的迪迪埃的答案解决了我们在装饰“功能”的文章中概述的问题。这很可能是搜索我想要的所有函数的阻力最小的路径。
Function.prototype.debug = function(){
var fn = this;
return function(){
if (debugme) debugger;
return fn.apply(this, arguments);
};
};
3 个解决方案