(type: CgcEventType, payload?: unknown)
| 22 | } |
| 23 | |
| 24 | public emit(type: CgcEventType, payload?: unknown): void { |
| 25 | const event: CgcEvent = { type, payload }; |
| 26 | for (const listener of this.listeners.get(type) ?? []) { |
| 27 | try { |
| 28 | listener(event); |
| 29 | } catch { |
| 30 | // individual listener failures must not break the bus |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | public dispose(): void { |
| 36 | this.listeners.clear(); |
no test coverage detected