| 1 | class EventEmitter { |
| 2 | #listeners = new Map(); |
| 3 | |
| 4 | on(event, listener) { |
| 5 | let listeners = this.#listeners.get(event); |
| 6 | if (!listeners) { |
| 7 | this.#listeners.set(event, (listeners = [])); |
| 8 | } |
| 9 | listeners.push(listener); |
| 10 | } |
| 11 | |
| 12 | emit(event, ...args) { |
| 13 | const listeners = this.#listeners.get(event); |
| 14 | if (listeners) { |
| 15 | for (const listener of listeners) { |
| 16 | listener.apply(null, args); |
| 17 | } |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | const EIOPacketType = { |
| 23 | OPEN: "0", |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…