恐怕,但ExtJS不提供任何事件分析。它使用自定義事件系統。
以下是我如何看到此問題的解決方案。
有Ext.util.Event類提供調度和處理框架中使用的任何事件的功能,並提供單點來分派所有框架事件(fireEvent僅僅是Ext.app.EventBus.dispatch方法的封裝)。
類是私人的,所以我建議看看它的源代碼。
可以覆蓋這些課程,看看它調用Ext.app.EventBus.dispatch方法,並呼籲像Ext.util.Event.fire方法水木清華(內事件偵聽器多少需要EventProfiler應該是你的自己的類)
Ext.app.EventBus
dispatch: function (/* event name or Ext.util.Event */event, /* Target class */ target, args) {
//start timing
var start = new Date();
/* ... */
for (i = 0, ln = events.length; i < ln; i++) {
event = events[i];
// Fire the event!
if (event.fire.apply(event, Array.prototype.slice.call(args, 1)) === false) {
return false;
}
// start event profiling
// here we are sure that event is dispatched and it's instance of Ext.util.Event
EventProfiler.startProfile(event, /* time passed from dispath method started */new Date() - start);
}
/* rest of dispatch method call */
}
Ext.util.Event
fire: function() {
/* ... */
if (listener.o) {
args.push(listener.o);
}
EventProfiler.endProfile(this);
if (listener && listener.fireFn.apply(listener.scope || me.observable, args) === false) {
return (me.firing = false);
}
/* ... */
}
順便說一句,你清理你的控制器是否正確?如果你銷燬了一個控制器,那麼EventBus上的監聽器就不會被框架清理乾淨。對不起,不是你的問題的答案,而是相關的。 – mistaecko
@mistaecko謝謝你的額外信息!這真的很好知道!但是,目前我沒有回收控制器,一旦它們被初始化,所以這應該不起作用。就我所看到的源代碼而言,控制器被存儲在ApplicationController的內部集合中。但我想這不是簡單的事件調度分析 – sra
如果你決定清理你的控制器,然後檢查我的答案如何銷燬控制器在這裏:http://stackoverflow.com/questions/12330846/how- to-delete-controller-extjs/12344788#12344788 – mistaecko