export class DTEvent{constructor(a,b={}){this.stopped=!1,this.type=void 0,this.event=void 0,this.params={},this.type=a,this.params=b}stopPropagation(){this.stopped=!0}}export function createEvent(a,b){return new DTEvent(a,b)}export default class EventEmitter{constructor(){this.$listeners={}}count(a){let b=0;return Object.keys(this.$listeners).filter(b=>!a||b===a).forEach(a=>{b+=a.length}),b}once(a,b){const c=(...d)=>{b.call(null,...d),this.removeEventListener(a,c)};return this.addEventListener(a,c),this}hasEventListener(a,b){return!!this.$listeners[a]&&-1<this.$listeners[a].indexOf(b)}getEventListener(a){return a?this.$listeners[a]||[]:this.$listeners}addEventListener(a,b){return this.$listeners[a]=this.$listeners[a]||[],-1===this.$listeners[a].indexOf(b)&&this.$listeners[a].push(b),()=>{this.removeEventListener(a,b)}}emit(a){"string"==typeof a&&(a=new DTEvent(a));const b=this.$listeners[a.type]||[];for(let c=0;c<b.length;c++)b[c].apply(this,[a])}removeEventListener(a,b){this.$listeners[a]=(this.$listeners[a]||[]).filter(a=>a!==b),0===this.$listeners[a].length&&delete this.$listeners[a]}removeAllListener(a){a?this.$listeners[a]=[]:this.$listeners={}}}