Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky committed Nov 10, 2023
1 parent b79e828 commit 86f7492
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/generic-utils/src/emitter/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export class Emitter<Contract extends EmitterContract = EmitterContract> {
this.maxListenersPerEvent = options?.maxListenersPerEvent ?? 10
}
private _callbacks: Partial<Contract> = {}
private _listenerExceededWarning = false
private _leakWarning = false

private _warnIfPossibleMemoryLeak<EventName extends keyof Contract>(
event: EventName
) {
if (this._listenerExceededWarning) {
if (this._leakWarning) {
return
}
if (
Expand All @@ -45,7 +45,7 @@ export class Emitter<Contract extends EmitterContract = EmitterContract> {
event
)} has exceeded ${this.maxListenersPerEvent} callbacks. `
)
this._listenerExceededWarning = true
this._leakWarning = true
}
}

Expand Down

0 comments on commit 86f7492

Please sign in to comment.