(
name: N
)
| 31 | >(); |
| 32 | |
| 33 | function getHandlersForEvent<N extends keyof EventsMap>( |
| 34 | name: N |
| 35 | ): Set<EventHandler<EventsMap[N]>> { |
| 36 | const existingSet = subscribersMap.get(name); |
| 37 | |
| 38 | if (existingSet) return existingSet; |
| 39 | |
| 40 | const newSet = new Set<EventHandler<unknown[]>>(); |
| 41 | |
| 42 | subscribersMap.set(name, newSet); |
| 43 | |
| 44 | return newSet; |
| 45 | } |
| 46 | |
| 47 | function on<N extends keyof EventsMap>( |
| 48 | name: N, |