-
9 Mar 2007 10:32 AM #1
Ext.util.Event.fire()
Ext.util.Event.fire()
If one of the listerners return false, this.firing = true is not reset to false, is this ok?Code:fire : function(){ var ls = this.listeners, scope, len = ls.length; if(len > 0){ this.firing = true; var args = Array.prototype.slice.call(arguments, 0); for(var i = 0; i < len; i++){ var l = ls[i]; if(l.fireFn.apply(l.scope, arguments) === false){ return false; } } this.firing = false; } return true; }
Thanks
-
9 Mar 2007 10:36 AM #2
It's just a minor detail. I see that this.firing is a flag for add/remove listerner method to tell if it can just slice the listerner array or make a copy first.
One question though, since javascript is single threaded, why is this necessary?
Thanks.
-
9 Mar 2007 11:57 PM #3
That is indeed an oversight. Thanks for pointing it out.
The reason for the flag is because a listener can remove itself in the handler call (e.g. a 1 time listener) and break the loop.
Similar Threads
-
how to stop click event when having dblclick event
By seldon in forum Ext 1.x: Help & DiscussionReplies: 5Last Post: 8 Nov 2011, 12:31 AM -
Observable.fire - behaviour changed.
By Animal in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 23 Feb 2007, 7:19 AM -
Fire clear event when Store is empty?
By aconran in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 22 Feb 2007, 4:39 PM -
struggle on event fire
By qiuyl in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 9 Dec 2006, 3:25 PM -
fire onclick but not ondrag
By Slapyo in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 29 Nov 2006, 11:11 PM


Reply With Quote