(...unsubscribes: WaveEventUnsubscribe[])
| 86 | } |
| 87 | |
| 88 | function waveEventUnsubscribe(...unsubscribes: WaveEventUnsubscribe[]) { |
| 89 | const eventTypeSet = new Set<string>(); |
| 90 | for (const unsubscribe of unsubscribes) { |
| 91 | const subjects = waveEventSubjects.get(unsubscribe.eventType); |
| 92 | if (subjects == null) { |
| 93 | return; |
| 94 | } |
| 95 | const idx = subjects.findIndex((s) => s.id === unsubscribe.id); |
| 96 | if (idx === -1) { |
| 97 | return; |
| 98 | } |
| 99 | subjects.splice(idx, 1); |
| 100 | if (subjects.length === 0) { |
| 101 | waveEventSubjects.delete(unsubscribe.eventType); |
| 102 | } |
| 103 | eventTypeSet.add(unsubscribe.eventType); |
| 104 | } |
| 105 | |
| 106 | for (const eventType of eventTypeSet) { |
| 107 | updateWaveEventSub(eventType); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | function getFileSubject(zoneId: string, fileName: string): SubjectWithRef<WSFileEventData> { |
| 112 | const subjectKey = zoneId + "|" + fileName; |
no test coverage detected