(workspaceId: string)
| 192 | } |
| 193 | |
| 194 | removeSubscriber(workspaceId: string): void { |
| 195 | const current = this.subscriberCounts.get(workspaceId) ?? 0; |
| 196 | const next = Math.max(0, current - 1); |
| 197 | if (next === 0) { |
| 198 | this.subscriberCounts.delete(workspaceId); |
| 199 | |
| 200 | const interval = this.tickIntervals.get(workspaceId); |
| 201 | if (interval) { |
| 202 | clearInterval(interval); |
| 203 | this.tickIntervals.delete(workspaceId); |
| 204 | } |
| 205 | |
| 206 | this.clearDeltaEmitState(workspaceId); |
| 207 | return; |
| 208 | } |
| 209 | this.subscriberCounts.set(workspaceId, next); |
| 210 | } |
| 211 | |
| 212 | onStatsChange(listener: (workspaceId: string) => void): void { |
| 213 | this.emitter.on("change", listener); |
no test coverage detected