“调试"ExtJS 脚本 [英] "Debugging" ExtJS script

查看:9
本文介绍了“调试"ExtJS 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何特定工具可用于调试"ExtJS 脚本?尤其是当屏幕变黑时,我发现很难调试.

Are there any particular tools available for "Debugging" ExtJS script ? Especially, I findi it difficult to debug when the screen goes blank.!

推荐答案

Aptana Studio 针对 Javascript 开发进行了优化,包括对 Firefox 和 IE 的调试支持,它甚至支持 Ext JS 库上的预输入(您可能需要单独下载一些 eclipse 插件).

Aptana Studio is optimised for Javascript development, including debug support for Firefox and IE, it even supports type-ahead on the Ext JS library (you might have to download some eclipse plugins separately).

Ext JS 包含在一个调试控制台(您需要添加 debug.js 并调用 Ext.log("blah") 来启动它),这将提供类似于 Firefox 上的 Firebug 的功能,但没有那么广泛,但仍然有用用于补充可怜的开发工具安装了 IE 8.Firebug(正如 Ergo 在这里提到的)是最强大的浏览器基于开发工具(它允许逐步调试)但是最新版本的 Chrome 和 Safari 也安装了有用的开发工具(但不如 Firebug 多).

Ext JS comes included with a debugging console (you need to add debug.js and call Ext.log("blah") to bring it up), this will provide functionality that is similar to Firebug on Firefox but not as extensive, still its useful for supplementing the poor development tools that come pre-installed with IE 8. Firebug (as Ergo mentioned here) is the most powerful of the browser-based development tools (it allows step-by-step debugging) however the latest versions of Chrome and Safari also come installed with develoment tools that are useful (but not as much as Firebug).

我发现在整个应用程序中运行调试跟踪可以加快查找错误的过程(参见下面的示例).

I find that running a debug trace throughout your application speeds up the process of finding bugs (see example below).

// Setup simple debugging tool
DebugManager = function {};
DebugManager.isEnabled = true;
DebugManager.log = function() {
  if (DebugManager.isEnabled && arguments.length && console && console.log) {
    try {
      // Single parameter? pass it to console
      if (arguments.length == 1) console.log(arguments[0])
      // Multiple parameters? output raw arguments array to the console
      else console.log(arguments);           
    } catch (e) {}
  }
};
// Your function
function doSomething(myString) {
 DebugManager.log("doSomething(myString)", myString);
 // code for doSomething
}

然后您可以查找控制台跟踪(Firebug 是最好的,因为它输出完整的对象信息)并注意在代码损坏之前执行的最后一个函数.

You can then look up the console trace (Firebug is the best since it outputs full object information) and note the last function that executed before your code broke.

经过几个月的 Ext JS 开发,我不得不说 Firebug + Aptana Studio 组合胜过其他开发工具.

After many months of Ext JS development I have to say that Firebug + Aptana Studio combo wins hands down on other tools for development.

这篇关于“调试"ExtJS 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆