From 53ac02eb54b2e1e43bc61a2459aed1aeea4d3cc6 Mon Sep 17 00:00:00 2001 From: Jason <37859597+zachowj@users.noreply.github.com> Date: Tue, 8 Aug 2023 00:35:10 -0700 Subject: [PATCH] fix: Fix duplication of expose as trigger events --- src/common/events/Events.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/events/Events.ts b/src/common/events/Events.ts index b9ded22074..993278287f 100644 --- a/src/common/events/Events.ts +++ b/src/common/events/Events.ts @@ -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); } }