src/js/module/event.js
function (element, type, handler, context) {
            var own = this;
            //非Dom元素不处理
            if (!(1 == element.nodeType || element.nodeType == 9 || element === window)|| !vQ.isFunction(handler)) {
                return;
            }
            //获取传入参数
            var args = slice.call(arguments);

            //批量绑定事件处理
            if (vQ.isArray(type)) {
                return own._handleMultipleEvents.apply(own, [own.one].concat(args));
                //return own._handleMultipleEvents(own.one, element, type, handler);
            }

            var func = function () {
                own.unbind(element, type, func);
                handler.apply(context || element, arguments);
            };

            // copy the guid to the new function so it can removed using the original function's ID
            func.$$guid = handler.$$guid = handler.$$guid || own._guid++;
            own.bind(element, type, func);


            //var func = function(){
            //    own.unbind.apply(own,args);
            //    handler.apply(context || element, arguments);
            //};
            ////args = [type, func].concat(args.slice(2));//更换fun 这样支持不定个数的参数
            //
            //// copy the guid to the new function so it can removed using the original function's ID
            //func.$$guid = handler.$$guid = handler.$$guid || own._guid++;
            ////own.observe(element, type, func);
            //own.bind.apply(own,args);
        }
function (element, type, handler, context) {
            var own = this;
            //非Dom元素不处理
            if (!(1 == element.nodeType || element.nodeType == 9 || element === window)|| !vQ.isFunction(handler)) {
                return;
            }
            //获取传入参数
            var args = slice.call(arguments);

            //批量绑定事件处理
            if (vQ.isArray(type)) {
                return own._handleMultipleEvents.apply(own, [own.one].concat(args));
                //return own._handleMultipleEvents(own.one, element, type, handler);
            }

            var func = function () {
                own.unbind(element, type, func);
                handler.apply(context || element, arguments);
            };

            // copy the guid to the new function so it can removed using the original function's ID
            func.$$guid = handler.$$guid = handler.$$guid || own._guid++;
            own.bind(element, type, func);


            //var func = function(){
            //    own.unbind.apply(own,args);
            //    handler.apply(context || element, arguments);
            //};
            ////args = [type, func].concat(args.slice(2));//更换fun 这样支持不定个数的参数
            //
            //// copy the guid to the new function so it can removed using the original function's ID
            //func.$$guid = handler.$$guid = handler.$$guid || own._guid++;
            ////own.observe(element, type, func);
            //own.bind.apply(own,args);
        }
function ( element , type , handler , context ) { var own = this ; //非Dom元素不处理 if ( ! ( 1 == element . nodeType || element . nodeType == 9 || element === window ) || ! vQ . isFunction ( handler ) ) { return ; } //获取传入参数 var args = slice . call ( arguments ) ; //批量绑定事件处理 if ( vQ . isArray ( type ) ) { return own . _handleMultipleEvents . apply ( own , [ own . one ] . concat ( args ) ) ; //return own._handleMultipleEvents(own.one, element, type, handler); } var func = function ( ) { own . unbind ( element , type , func ) ; handler . apply ( context || element , arguments ) ; } ; // copy the guid to the new function so it can removed using the original function's ID func . $$guid = handler . $$guid = handler . $$guid || own . _guid ++ ; own . bind ( element , type , func ) ; //var func = function(){ //    own.unbind.apply(own,args); //    handler.apply(context || element, arguments); //}; ////args = [type, func].concat(args.slice(2));//更换fun 这样支持不定个数的参数 // //// copy the guid to the new function so it can removed using the original function's ID //func.$$guid = handler.$$guid = handler.$$guid || own._guid++; ////own.observe(element, type, func); //own.bind.apply(own,args); }
Trigger a listener only once for an event
@param  {Element|Object}   elem Element or object to
@param  {String|Array}   type
@param  {Function} fn
@private
Trigger a listener only once for an event