Skip to content

Commit

Permalink
fix: Fix duplication of expose as trigger events
Browse files Browse the repository at this point in the history
  • Loading branch information
zachowj committed Aug 8, 2023
1 parent a290099 commit 53ac02e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/common/events/Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ export default class Events {
handler: EventHandler,
options = { once: false }
): void {
this.#listeners.push([event, this.#errorHandler(handler)]);
const handlerWrapper = this.#errorHandler(handler);

this.#listeners.push([event, handlerWrapper]);

if (options.once === true) {
this.emitter.once(event, this.#errorHandler(handler));
this.emitter.once(event, handlerWrapper);
} else {
this.emitter.on(event, this.#errorHandler(handler));
this.emitter.on(event, handlerWrapper);
}
}

Expand Down

0 comments on commit 53ac02e

Please sign in to comment.