* Remove an event handler for the given type. * If `handler` is omitted, all handlers of the given type are removed. * @param {string|symbol} type Type of event to unregister `handler` from (`'*'` to remove a wildcard handler) * @param {Function} [handler] Handler function to remove * @m
(type: Key, handler?: GenericEventHandler)
| 80 | * @memberOf mitt |
| 81 | */ |
| 82 | off<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) { |
| 83 | const handlers: Array<GenericEventHandler> | undefined = all!.get(type); |
| 84 | if (handlers) { |
| 85 | if (handler) { |
| 86 | handlers.splice(handlers.indexOf(handler) >>> 0, 1); |
| 87 | } else { |
| 88 | all!.set(type, []); |
| 89 | } |
| 90 | } |
| 91 | }, |
| 92 | |
| 93 | /** |
| 94 | * Invoke all handlers for the given type. |
nothing calls this directly
no outgoing calls
no test coverage detected