src/core/core.js
function(event, data) {
        if (!this._callbacks[event] || this.__callbacksFrozen) {
            return;
        }
        var callbacks = this._callbacks[event];

        // Callback loop; deletes dead callbacks, but only when it is safe to do so
        var i,
            l = callbacks.length;
        // callbacks.depth tracks whether this function was invoked in the middle of a previous iteration through the same callback array
        callbacks.depth++;
        for (i = 0; i < l; i++) {
            if (typeof callbacks[i] === "undefined") {
                if (callbacks.depth <= 1) {
                    callbacks.splice(i, 1);
                    i--;
                    l--;
                    // Delete callbacks object if there are no remaining bound events
                    if (callbacks.length === 0) {
                        delete this._callbacks[event];
                        delete handlers[event][this[0]];
                    }
                }
            } else {
                callbacks[i].call(this, data);
            }
        }
        callbacks.depth--;
    }
function(event, data) {
        if (!this._callbacks[event] || this.__callbacksFrozen) {
            return;
        }
        var callbacks = this._callbacks[event];

        // Callback loop; deletes dead callbacks, but only when it is safe to do so
        var i,
            l = callbacks.length;
        // callbacks.depth tracks whether this function was invoked in the middle of a previous iteration through the same callback array
        callbacks.depth++;
        for (i = 0; i < l; i++) {
            if (typeof callbacks[i] === "undefined") {
                if (callbacks.depth <= 1) {
                    callbacks.splice(i, 1);
                    i--;
                    l--;
                    // Delete callbacks object if there are no remaining bound events
                    if (callbacks.length === 0) {
                        delete this._callbacks[event];
                        delete handlers[event][this[0]];
                    }
                }
            } else {
                callbacks[i].call(this, data);
            }
        }
        callbacks.depth--;
    }
function ( event , data ) { if ( ! this . _callbacks [ event ] || this . __callbacksFrozen ) { return ; } var callbacks = this . _callbacks [ event ] ; // Callback loop; deletes dead callbacks, but only when it is safe to do so var i , l = callbacks . length ; // callbacks.depth tracks whether this function was invoked in the middle of a previous iteration through the same callback array callbacks . depth ++ ; for ( i = 0 ; i < l ; i ++ ) { if ( typeof callbacks [ i ] === "undefined" ) { if ( callbacks . depth <= 1 ) { callbacks . splice ( i , 1 ) ; i -- ; l -- ; // Delete callbacks object if there are no remaining bound events if ( callbacks . length === 0 ) { delete this . _callbacks [ event ] ; delete handlers [ event ] [ this [ 0 ] ] ; } } } else { callbacks [ i ] . call ( this , data ) ; } } callbacks . depth -- ; }
Process for running all callbacks for the given event
Process for running all callbacks for the given event