class Events {
    constructor() {
        this._events = {};
    }

    _getEventFns(eventName) {
        return this._events[eventName] || [];
    }

    _hasEvent(eventName, fn) {
        var eventFns = this._getEventFns(eventName);
        return eventFns.indexOf(fn) > -1;
    }

    on(eventName, fn) {
        if (!this._hasEvent(eventName, fn)) {
            if (!this._events[eventName]) {
                this._events[eventName] = [];
            }
            this._events[eventName].push(fn);
        }
    }

    off(eventName, fn) {
        if (!eventName && !fn) {
            for (var e in this._events) {
                delete this._events[e];
            }
        } else if (eventName && !fn) {
            delete this._events[eventName];
        } else if (eventName && fn) {
            var eventFns = this._getEventFns(eventName);
            var idx = eventFns.indexOf(fn);
            if (idx > -1) {
                eventFns.splice(idx, 1);
            }
        }
    }

    trigger(eventName, extraArgsArray) {
        extraArgsArray = extraArgsArray || [];

        var eventFns = this._getEventFns(eventName);
        var eventArgs = [{ target: this }].concat(extraArgsArray);
        eventFns.forEach((fn, i) => {
            fn.apply(this, eventArgs);
        });
    }
}

export default Events;

@@ -55,10 +55,17 @@
 s = 
-%7B%7D
+new Map()
 ;%0A  
@@ -118,33 +118,37 @@
 urn this._events
-%5B
+.get(
 eventName%5D %7C%7C %5B%5D
@@ -140,17 +140,17 @@
 ventName
-%5D
+)
  %7C%7C %5B%5D;%0A
@@ -380,33 +380,37 @@
 f (!this._events
-%5B
+.get(
 eventName%5D) %7B%0A  
@@ -402,17 +402,17 @@
 ventName
-%5D
+)
 ) %7B%0A    
@@ -427,33 +427,37 @@
     this._events
-%5B
+.set(
 eventName%5D = %5B%5D;
@@ -453,14 +453,13 @@
 Name
-%5D =
+,
  %5B%5D
+)
 ;%0A  
@@ -486,33 +486,37 @@
     this._events
-%5B
+.get(
 eventName%5D.push(
@@ -508,17 +508,17 @@
 ventName
-%5D
+)
 .push(fn
@@ -611,91 +611,29 @@
     
-for (var e in this._events) %7B%0A                delete this._events%5Be%5D;%0A            %7D
+this._events.clear();
 %0A   
@@ -684,15 +684,8 @@
     
-delete 
 this
@@ -692,17 +692,24 @@
 ._events
-%5B
+.delete(
 eventNam
@@ -709,17 +709,17 @@
 ventName
-%5D
+)
 ;%0A      

use map instead of obj