Skip to content

Commit

Permalink
Inline dispatch event method
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrgicak committed Mar 12, 2024
1 parent f8694b8 commit 93e28c0
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions packages/php-wasm/logger/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -133,7 +123,13 @@ export class Logger extends EventTarget {
'Fatal',
'PHP-WASM'
);
this.maybeDispatchFatalErrorEvent();
this.dispatchEvent(
new CustomEvent(this.fatalErrorEvent, {
detail: {
logs: this.getLogs(),
},
})
);
}
});
}
Expand Down

0 comments on commit 93e28c0

Please sign in to comment.