(eventName: U, callback: (data: Partial<T>) => void)
| 2 | private listeners: { [key in U]?: Array<(data: Partial<T>) => void> } = {}; |
| 3 | |
| 4 | on(eventName: U, callback: (data: Partial<T>) => void) { |
| 5 | if (!this.listeners[eventName]) { |
| 6 | this.listeners[eventName] = []; |
| 7 | } |
| 8 | this.listeners[eventName]?.push(callback); |
| 9 | } |
| 10 | |
| 11 | off(eventName: U, callback: (data: Partial<T>) => void) { |
| 12 | if (this.listeners[eventName]) { |
no outgoing calls
no test coverage detected