1. #1
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,663
    Vote Rating
    489
    LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future

      0  

    Default Observable.fireEventArgs - why was it added in 4.2?

    What's the reason this new method was added? Does fireEventArgs provide better performance?

    When would I use fireEventArgs as opposed to fireEvent?

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,690
    Vote Rating
    769
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      1  

    Default

    Code:
    fireEvent: function(eventName) {
        return this.fireEventArgs(eventName, arraySlice.call(arguments, 1));
    },
    
    fireEventArgs: function(eventName, args) {
        eventName = eventName.toLowerCase();
        var me = this,
            events = me.events,
            event = events && events[eventName],
            ret = true;
    
        // Only continue firing the event if there are listeners to be informed.
        // Bubbled events will always have a listener count, so will be fired.
        if (event && me.hasListeners[eventName]) {
            ret = me.continueFireEvent(eventName, args || emptyArray, event.bubble);
        }
        return ret;
    },
    As you can see in the code, fireEvent calls fireEventArgs after pulling out the event name and casting the remaining arguments into an array. It was added for places where we're calling an event with the same arguments (think tree bubbling events).

    Edit: To elaborate

    Code:
    // Functionally equivalent
    this.fireEvent('foo', 1, 'b', 3]);
    this.fireEventArgs('foo', [1, 'b', 3]);
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User wemerson.januario's Avatar
    Join Date
    Nov 2008
    Location
    Brazil, Goiânia
    Posts
    523
    Vote Rating
    26
    wemerson.januario will become famous soon enough wemerson.januario will become famous soon enough

      0  

    Default

    very util this method
    Wemerson Januario
    Website: http://wemersonjanuario.com.br
    Twitter: https://twitter.com/januariocoder

    Email: wemerson.januario@gmail.com

    From: Goiânia, Brazil
    Ext JS Consulting, Training, Support

Thread Participants: 2