-
16 Feb 2011 5:52 PM #1
[CLOSED]Ext.util.Event and fire bug?
[CLOSED]Ext.util.Event and fire bug?
The fire method in Ext.util.Event adds an additional object to the event arguments. Is this intended or a bug?
Example:
In Ext3 you get 2 arguments:Code:new Ext.Button({ text:'Hello World', renderTo:Ext.getBody(), listeners:{ click:function(){ console.log(arguments); } } });
In Ext4 you get 3 arguments:Code:[Object { initialConfig={...}, text="Hello World", more...}, Object { browserEvent=, button=0, more...}]
This is caused by ext-core-debug.js:12813:fire:Code:[Object { initialConfig={...}, text="Hello World", more...}, Object { browserEvent=, type="click", more...}, Object {}]
Code:if (listener.o) { args.push(listener.o); }
-
17 Feb 2011 3:16 AM #2Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Haarlem, Netherlands
- Posts
- 1,235
- Vote Rating
- 4
This is useful for passing on any data to the listeners. By adding it to the options object when you set up the listener, you can access them easily. Also it allows you to do specific behavior in your listeners based on the options you used to set them up (like buffer, delay etc).
-
17 Feb 2011 3:41 AM #3
I see the benefit of passing the listener object to the handler function inside the same listener. Since the listener.o is added by default means that EVERY fireEvent call in the framework will have this extra argument. Unless this is carefully re-factored in the framework it will case hard to find bugs when using/slicing the javascript arguments variable.
I noticed this because I have implemented a custom Ext.Direct provider for our Ext4Yii framework. The provider broke since the listener.o was not expected as an arguments item.
I fixed it using array.pop() in our provider.
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
[CLOSED] GXT 1.1.2: DateField does not fire Change Event
By firejack in forum Ext GWT: Bugs (1.x)Replies: 5Last Post: 23 Aug 2011, 3:38 AM -
Why is scope declared in Ext.util.Event fire() method?
By andyatmiami in forum Ext 2.x: Help & DiscussionReplies: 3Last Post: 5 Jul 2009, 4:19 AM -
Fire event when a tab is closed
By Esparry in forum Ext 2.x: Help & DiscussionReplies: 8Last Post: 2 Jul 2009, 6:50 AM -
Ext.util.Event.fire()
By papasi in forum Ext 1.x: BugsReplies: 2Last Post: 9 Mar 2007, 11:57 PM


Reply With Quote
