diff --git a/src/event-bus.js b/src/event-bus.js index d2e8416..4ae150c 100644 --- a/src/event-bus.js +++ b/src/event-bus.js @@ -12,13 +12,13 @@ class HYEventBus { throw new TypeError("the event callback must be function type") } - let hanlders = this.eventBus[eventName] - if (!hanlders) { - hanlders = [] - this.eventBus[eventName] = hanlders + const handlers = this.eventBus[eventName] + if (!handlers) { + this.eventBus[eventName] = [{ eventCallback, thisArg }] + return } - hanlders.push({ + handlers.push({ eventCallback, thisArg })