Skip to content

Commit

Permalink
Merge pull request #69 from lordnox/patch-1
Browse files Browse the repository at this point in the history
fix: add if exists to eventEmitter
  • Loading branch information
ChiriVulpes authored Dec 9, 2023
2 parents 2964630 + 49d065f commit 0e60385
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/util/EventEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ class EventEmitter implements NodeEventEmitter {
}

public emit (eventName: string | symbol, ...args: any[]): boolean {
for (const listener of this._listeners[eventName])
listener(...args);
if (this._listeners[eventName])
for (const listener of this._listeners[eventName])
listener(...args);
return true;
}

Expand Down Expand Up @@ -106,4 +107,4 @@ class EventEmitter implements NodeEventEmitter {
}
}

export default EventEmitter;
export default EventEmitter;

0 comments on commit 0e60385

Please sign in to comment.