[英]Firebug / Chrome debugger inside 1-line function
This question is entirely for my own curiosity. 这个问题完全出于我自己的好奇心。 So there are a lot of methods in Angular (and probably other frameworks) that are defined anonymously on one line.
因此,Angular(可能还有其他框架)中有很多方法是在一行上匿名定义的。 For example (taken from angular-route.js):
例如(取自angular-route.js):
$http.get(templateUrl, {cache: $templateCache}).
then(function(response) { return response.data; })
I want to set a breakpoint inside the promise callback and inspect what's in response
at that point. 我想在promise回调中设置一个断点,并检查当时的
response
。 For the moment I've just been temporarily hacking at the source, which isn't ideal. 就目前而言,我只是暂时在源代码上进行黑客入侵,这并不理想。
This is an odd request, I know, and I'm almost certain the UI doesn't provide for it. 我知道这是一个奇怪的请求,而且我几乎可以确定UI并未提供该请求。 But you never know.
但是你永远不知道。
I guess what you're actually asking for is to be able to format the code, so it's easy to set the breakpoint right at the return response.data;
我猜您实际上在要求的是能够格式化代码,因此很容易在
return response.data;
处设置断点return response.data;
statement. 声明。
The Chrome DevTools have an option for this: Chrome DevTools为此提供了一个选项:
as well as the Firefox DevTools: 以及Firefox DevTools:
In combination with source maps it's possible to debug minified code easily. 与源映射结合使用,可以轻松调试精简的代码。
For Firebug it is also planned for one of the next versions to integrate code pretty-printing and source maps. 对于Firebug,还计划在下一个版本中集成代码漂亮打印和源映射。 See issue 1238 and issue 5765 there.
请参阅问题1238和那里的问题5765 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.