* Add event listener * @param {string} event - Event name * @param {Function} handler - Event handler
(event, handler)
| 161 | * @param {Function} handler - Event handler |
| 162 | */ |
| 163 | on(event, handler) { |
| 164 | if (!this.socket) { |
| 165 | console.warn("Cannot add listener: socket not initialized"); |
| 166 | return; |
| 167 | } |
| 168 | |
| 169 | this.socket.on(event, handler); |
| 170 | this.listeners.set(event + handler.toString(), handler); |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Remove event listener |
no test coverage detected