/**
 * hilojs 2.0.0 for kissy
 * Copyright 2016 alibaba.com
 * Licensed under the MIT License
 */
KISSY.add("hilo/event/EventMixin",function(t,e){var i={_listeners:null,on:function(t,e,i){for(var n=this._listeners=this._listeners||{},r=n[t]=n[t]||[],s=0,l=r.length;s<l;s++){var a=r[s];if(a.listener===e)return}return r.push({listener:e,once:i}),this},off:function(t,e){if(0==arguments.length)return this._listeners=null,this;var i=this._listeners&&this._listeners[t];if(i){if(1==arguments.length)return delete this._listeners[t],this;for(var n=0,r=i.length;n<r;n++){var s=i[n];if(s.listener===e){i.splice(n,1),0===i.length&&delete this._listeners[t];break}}}return this},fire:function(t,e){var i,r;"string"==typeof t?r=t:(i=t,r=t.type);var s=this._listeners;if(!s)return!1;var l=s[r];if(l){var a=l.slice(0);if(i=i||new n(r,this,e),i._stopped)return!1;for(var o=0;o<a.length;o++){var h=a[o];if(h.listener.call(this,i),h.once){var f=l.indexOf(h);f>-1&&l.splice(f,1)}}return 0==l.length&&delete s[r],!0}return!1}},n=e.create({constructor:function(t,e,i){this.type=t,this.target=e,this.detail=i,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),r=window.Event;if(r){var s=r.prototype,l=s.stopImmediatePropagation;s.stopImmediatePropagation=function(){l&&l.call(this),this._stopped=!0}}return i},{requires:["hilo/core/Class"]});