(name: N, ...data: EventsMap[N])
| 77 | } |
| 78 | |
| 79 | function emit<N extends keyof EventsMap>(name: N, ...data: EventsMap[N]) { |
| 80 | if (IS_DEV && DEV_DEBUG_EVENTS && debug) { |
| 81 | console.warn(`Event [${debug}]`, name, data); |
| 82 | } |
| 83 | |
| 84 | runInAction(() => { |
| 85 | const listeners = getHandlersForEvent(name); |
| 86 | |
| 87 | listeners.forEach((listener) => { |
| 88 | listener(...data); |
| 89 | }); |
| 90 | }); |
| 91 | } |
| 92 | |
| 93 | function removeAllListeners() { |
| 94 | subscribersMap.clear(); |
nothing calls this directly
no test coverage detected