class EventEmitt { constructor () { this.handlers = {} } on (eventName, cb) { if (!this.handlers[eventName]) { this.handlers[eventName] = [] } this.handlers[eventName].push(cb) } emit (eventName, ...args) { if (this.handlers[eventName]) { this.handlers[eventName].forEach(callback => { callback(...args) }) } } }