src/mixin/Eventful.js
function (type) {
        var _h = this._$handlers[type];
        var eventProcessor = this._$eventProcessor;

        if (_h) {
            var args = arguments;
            var argLen = args.length;

            if (argLen > 3) {
                args = arrySlice.call(args, 1);
            }

            var len = _h.length;
            for (var i = 0; i < len;) {
                var hItem = _h[i];
                if (eventProcessor
                    && eventProcessor.filter
                    && hItem.query != null
                    && !eventProcessor.filter(type, hItem.query)
                ) {
                    i++;
                    continue;
                }

                // Optimize advise from backbone
                switch (argLen) {
                    case 1:
                        hItem.h.call(hItem.ctx);
                        break;
                    case 2:
                        hItem.h.call(hItem.ctx, args[1]);
                        break;
                    case 3:
                        hItem.h.call(hItem.ctx, args[1], args[2]);
                        break;
                    default:
                        // have more than 2 given arguments
                        hItem.h.apply(hItem.ctx, args);
                        break;
                }

                if (hItem.one) {
                    _h.splice(i, 1);
                    len--;
                }
                else {
                    i++;
                }
            }
        }

        eventProcessor && eventProcessor.afterTrigger
            && eventProcessor.afterTrigger(type);

        return this;
    }
function (type) {
        var _h = this._$handlers[type];
        var eventProcessor = this._$eventProcessor;

        if (_h) {
            var args = arguments;
            var argLen = args.length;

            if (argLen > 3) {
                args = arrySlice.call(args, 1);
            }

            var len = _h.length;
            for (var i = 0; i < len;) {
                var hItem = _h[i];
                if (eventProcessor
                    && eventProcessor.filter
                    && hItem.query != null
                    && !eventProcessor.filter(type, hItem.query)
                ) {
                    i++;
                    continue;
                }

                // Optimize advise from backbone
                switch (argLen) {
                    case 1:
                        hItem.h.call(hItem.ctx);
                        break;
                    case 2:
                        hItem.h.call(hItem.ctx, args[1]);
                        break;
                    case 3:
                        hItem.h.call(hItem.ctx, args[1], args[2]);
                        break;
                    default:
                        // have more than 2 given arguments
                        hItem.h.apply(hItem.ctx, args);
                        break;
                }

                if (hItem.one) {
                    _h.splice(i, 1);
                    len--;
                }
                else {
                    i++;
                }
            }
        }

        eventProcessor && eventProcessor.afterTrigger
            && eventProcessor.afterTrigger(type);

        return this;
    }
function ( type ) { var _h = this . _$handlers [ type ] ; var eventProcessor = this . _$eventProcessor ; if ( _h ) { var args = arguments ; var argLen = args . length ; if ( argLen > 3 ) { args = arrySlice . call ( args , 1 ) ; } var len = _h . length ; for ( var i = 0 ; i < len ; ) { var hItem = _h [ i ] ; if ( eventProcessor && eventProcessor . filter && hItem . query != null && ! eventProcessor . filter ( type , hItem . query ) ) { i ++ ; continue ; } // Optimize advise from backbone switch ( argLen ) { case 1 : hItem . h . call ( hItem . ctx ) ; break ; case 2 : hItem . h . call ( hItem . ctx , args [ 1 ] ) ; break ; case 3 : hItem . h . call ( hItem . ctx , args [ 1 ] , args [ 2 ] ) ; break ; default : // have more than 2 given arguments hItem . h . apply ( hItem . ctx , args ) ; break ; } if ( hItem . one ) { _h . splice ( i , 1 ) ; len -- ; } else { i ++ ; } } } eventProcessor && eventProcessor . afterTrigger && eventProcessor . afterTrigger ( type ) ; return this ; }
Dispatch a event.

@param {string} type The event name.
Dispatch a event .