Skip to content

Commit

Permalink
refactor: improve event module performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Sorikairox committed Feb 20, 2024
1 parent 1a3df74 commit 8e7c930
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/events/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class EventEmitterModule implements OnAppBootstrap, OnAppClose {
// deno-lint-ignore no-explicit-any
private registerAvailableEventListeners(injectableInstance: any) {
const methods = Object.getOwnPropertyNames(injectableInstance.constructor.prototype);
const emitter = injector.get<EventEmitter>(EventEmitter);

for (const method of methods) {
const target = injectableInstance[method];
Expand All @@ -38,7 +39,6 @@ export class EventEmitterModule implements OnAppBootstrap, OnAppClose {
if (!eventListenerMedatada) continue;
const { channel } = eventListenerMedatada;

const emitter = injector.get<EventEmitter>(EventEmitter);
emitter.subscribe(channel, target);
this.logger.log(`registering method '${method}' to event '${channel}'`);
}
Expand Down

0 comments on commit 8e7c930

Please sign in to comment.