@mitchellsimoens
Thanks for the review. I have to disagree about your first point though regarding listeners. If you examine the observable code, you will notice that passing an object to the listener is less efficient because it must iterate the object and call itself for each case. It also incurs a regex performance hit for every iteration. I ran some tests to prove it.
Running on Chrome v17.0
Code:
var c = new Ext.Component();
var i = 0;
var start = new Date().valueOf();
for (i = 0; i < 50000; i++){
c.on('show',Ext.emptyFn);
c.on('hide',Ext.emptyFn);
c.on('activate',Ext.emptyFn);
c.on('beforeshow',Ext.emptyFn);
c.on('beforehide',Ext.emptyFn);
}
var end = new Date().valueOf();
console.log(end - start);
Averaged about 1239 ms.
Code:
var c = new Ext.Component();
var i = 0;
var start = new Date().valueOf();
for (i = 0; i < 50000; i++){
c.on({
'show':Ext.emptyFn,
'hide':Ext.emptyFn,
'activate':Ext.emptyFn,
'beforeshow':Ext.emptyFn,
'beforehide':Ext.emptyFn
});
}
var end = new Date().valueOf();
console.log(end - start);
Averaged about 1499 ms.
-----
Thanks for the record loop suggestion. I am always at odds when it comes to loops b/c the Ext.each is convenient, results in slightly less code, and easier to read IMO. I would also think that it is more resilient to API changes, but that is just a guess. None the less, I have made the change and should be available on github now.