javascript 使用 console.log() 调试 ExtJS 4
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11314146/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Debugging ExtJS 4 using console.log()
提问by sozhen
I am very new to ExtJS and still going through the Docs in Sencha site. I've seen a lot of examplesin ExtJS4 using console.log() for debugging. However I couldn't figure out how to deal with console.log().
我对 ExtJS 非常陌生,并且仍在浏览 Sencha 站点中的文档。我在 ExtJS4 中看到了很多使用 console.log() 进行调试的例子。但是我不知道如何处理 console.log()。
I am using Aptana Studio 3 for development, and I don't think Aptana can run console.log() (correct me if im wrong). So we need to debug it in Firebug? Then how to incorporate script files like ext-all.js, ext-debug.js into Firebug?
我使用 Aptana Studio 3 进行开发,我认为 Aptana 不能运行 console.log() (如果我错了,请纠正我)。那么我们需要在Firebug中调试它吗?那么如何将ext-all.js、ext-debug.js等脚本文件合并到Firebug中呢?
回答by JohnnyHK
Right, the console.log()
output from your scripts goes to the console window of the developer tools of whatever browser you're using (e.g. Firebug for Firefox). The browser developer tool picks up the script files from the same place the browser does; i.e. however you have them loaded into your web page.
是的,console.log()
您的脚本的输出会进入您使用的任何浏览器(例如 Firebug for Firefox)的开发人员工具的控制台窗口。浏览器开发工具从浏览器所在的位置获取脚本文件;即但是您已将它们加载到您的网页中。
回答by DarkKnightFan
I would recommend you to use Google chrome. It has a very good developer tool. Apart from that for ExtJs, use ext-all-dev.js file instead of ext-all.js or ext-all-debug.js while doing any development. It will be really helpful. Check this linkfor more details.
我建议你使用谷歌浏览器。它有一个非常好的开发工具。除了 ExtJs 之外,在进行任何开发时使用 ext-all-dev.js 文件而不是 ext-all.js 或 ext-all-debug.js 文件。这将非常有帮助。查看此链接了解更多详情。
Also you can set breakpoints by simply using the command debugger;
in your javascript file.
But to make this work make sure firebug/developer tool is running.
您也可以通过简单地使用debugger;
javascript 文件中的命令来设置断点。但要使这项工作正常运行,请确保 firebug/developer tool 正在运行。
Hope this helps.
希望这可以帮助。