PDA

View Full Version : Question about the performance of the listeners and the handler



noamway
1 Sep 2010, 8:40 AM
Hi,

I like to know, if I need a click event what do I need to use. the listeners or the handler?

Does the listeners take more performance?

Thanks,
Noam

laurentParis
1 Sep 2010, 9:15 AM
handler is linked to button//menu
if you're looking on source code you can found the answer of your "question" :


// private method of Ext.Button = Ext.extend(Ext.BoxComponent,...
onClick : function(e){
.......
this.fireEvent('click', this, e);
if(this.handler){
//this.el.removeClass('x-btn-over');
this.handler.call(this.scope || this, this, e);
}
}
},

I hope that this source code give to you some comprehension information !
For me, the only good information that have some interest, is that click event is called before handler method ))

noamway
1 Sep 2010, 9:24 AM
I'm sorry for the misunderstanding, I have to be sure.
The example you give is proving that handler is better, right (when we lisen to 'click' event)?