* Subscribe to a specific event * @template E Event name type * @param event - Event name to subscribe to * @param handler - Event handler function * @returns Function to unsubscribe
(event: E, handler: (payload: T[E]) => void)
| 19 | * @returns Function to unsubscribe |
| 20 | */ |
| 21 | on<E extends keyof T>(event: E, handler: (payload: T[E]) => void) { |
| 22 | this.#emitter.on(event, handler); |
| 23 | |
| 24 | return () => { |
| 25 | this.#emitter.off(event, handler); |
| 26 | }; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Subscribe to all events |
no outgoing calls
no test coverage detected