Skip to content

Commit

Permalink
remove redundant memo
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Ferrari committed Sep 7, 2022
1 parent ec8206b commit 39a33b4
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/strongbus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class Bus<TEventMap extends Events.EventMap = Events.EventMap> implements
}

private _active = false;
private _ownListenerTotalCount: number = 0;
private _delegates = new Map<Bus<TEventMap>, Events.Subscription[]>();
private _delegateListenerTotalCount: number = 0;
private _delegateListenerCountsByEvent = new Map<EventKeys<TEventMap>|Events.WILDCARD, number>();
Expand Down Expand Up @@ -569,7 +568,7 @@ export class Bus<TEventMap extends Events.EventMap = Events.EventMap> implements
}

public get listenerCount(): number {
return this._ownListenerTotalCount + this._delegateListenerTotalCount;
return this.bus.size + this._delegateListenerTotalCount;
}

public getListenerCountFor(event: EventKeys<TEventMap>|Events.WILDCARD): number {
Expand Down Expand Up @@ -728,7 +727,6 @@ export class Bus<TEventMap extends Events.EventMap = Events.EventMap> implements
this._cachedGetListersValue = null;
if(bus === this) {
this._cachedGetOwnListenersValue = null;
this._ownListenerTotalCount = Math.max(this._ownListenerTotalCount + 1, 0);
} else {
const currCount = this._delegateListenerCountsByEvent.get(event) ?? 0;
this._delegateListenerCountsByEvent.set(event, Math.max(currCount + 1, 0));
Expand Down Expand Up @@ -758,7 +756,6 @@ export class Bus<TEventMap extends Events.EventMap = Events.EventMap> implements
this._cachedGetListersValue = null;
if(bus === this) {
this._cachedGetOwnListenersValue = null;
this._ownListenerTotalCount = Math.max(this._ownListenerTotalCount - 1, 0);
} else {
const currCount = this._delegateListenerCountsByEvent.get(event) ?? 0;
this._delegateListenerCountsByEvent.set(event, Math.max(currCount - 1, 0));
Expand Down

0 comments on commit 39a33b4

Please sign in to comment.