From 93e28c076dcf467518b6d30718311f7cd366562b Mon Sep 17 00:00:00 2001 From: Bero Date: Tue, 12 Mar 2024 13:45:09 +0100 Subject: [PATCH] Inline dispatch event method --- packages/php-wasm/logger/src/logger.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/php-wasm/logger/src/logger.ts b/packages/php-wasm/logger/src/logger.ts index 3c21d33e47..14e142ad05 100644 --- a/packages/php-wasm/logger/src/logger.ts +++ b/packages/php-wasm/logger/src/logger.ts @@ -79,16 +79,6 @@ export class Logger extends EventTarget { this.log(`${event.reason.stack}`, 'Error'); } - public maybeDispatchFatalErrorEvent() { - this.dispatchEvent( - new CustomEvent(this.fatalErrorEvent, { - detail: { - logs: this.getLogs(), - }, - }) - ); - } - /** * Register a listener for the window error events and log the data. */ @@ -133,7 +123,13 @@ export class Logger extends EventTarget { 'Fatal', 'PHP-WASM' ); - this.maybeDispatchFatalErrorEvent(); + this.dispatchEvent( + new CustomEvent(this.fatalErrorEvent, { + detail: { + logs: this.getLogs(), + }, + }) + ); } }); }