简体   繁体   English

1行功能内的Firebug / Chrome调试器

[英]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.

相关问题 如何借助Firebug或IE 8调试器或chrome调试器找出javascript函数的流程? - Way to figure out the flow of javascript function with the help of firebug or IE 8 debugger or chrome debugger? Chrome调试器-如何在不进入功能的情况下转到下一行? - Chrome debugger - how to go to next line without entring in function? 如何使用firefox / firebug / chrome调试器获取局部变量数组? - How to get local variables array with firefox/firebug/chrome debugger? 动态加载的js函数不会出现在Firebug js调试器中 - dynamically loaded js function does not appear in Firebug js debugger 适用于Chrome的Firebug - Firebug for Chrome Firebug调试器无法正常工作 - Firebug debugger not working 在 Chrome 调试器中启动 onClick 功能 - Start onClick function in Chrome debugger Chrome调试器仅在第一行停止 - Chrome debugger only stopping at first line 在 Chrome 调试器中,是否有引用匿名 function 块内的数据或函数? - When in the Chrome Debugger, is there anyway to reference data or functions inside an anonymous function block? 如何查看附加的样式:firebug中的悬停和其他伪类以及chrome调试器 - How can I see the styles attached to :hover and other pseudo classes in firebug and the chrome debugger
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM