Skip to content

Commit 39a33b4

Browse files
author
Ethan Ferrari
committed
remove redundant memo
1 parent ec8206b commit 39a33b4

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/strongbus.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ export class Bus<TEventMap extends Events.EventMap = Events.EventMap> implements
6868
}
6969

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

571570
public get listenerCount(): number {
572-
return this._ownListenerTotalCount + this._delegateListenerTotalCount;
571+
return this.bus.size + this._delegateListenerTotalCount;
573572
}
574573

575574
public getListenerCountFor(event: EventKeys<TEventMap>|Events.WILDCARD): number {
@@ -728,7 +727,6 @@ export class Bus<TEventMap extends Events.EventMap = Events.EventMap> implements
728727
this._cachedGetListersValue = null;
729728
if(bus === this) {
730729
this._cachedGetOwnListenersValue = null;
731-
this._ownListenerTotalCount = Math.max(this._ownListenerTotalCount + 1, 0);
732730
} else {
733731
const currCount = this._delegateListenerCountsByEvent.get(event) ?? 0;
734732
this._delegateListenerCountsByEvent.set(event, Math.max(currCount + 1, 0));
@@ -758,7 +756,6 @@ export class Bus<TEventMap extends Events.EventMap = Events.EventMap> implements
758756
this._cachedGetListersValue = null;
759757
if(bus === this) {
760758
this._cachedGetOwnListenersValue = null;
761-
this._ownListenerTotalCount = Math.max(this._ownListenerTotalCount - 1, 0);
762759
} else {
763760
const currCount = this._delegateListenerCountsByEvent.get(event) ?? 0;
764761
this._delegateListenerCountsByEvent.set(event, Math.max(currCount - 1, 0));

0 commit comments

Comments
 (0)