MCPcopy Index your code
hub / github.com/developit/mitt / emit

Function emit

src/index.ts:103–121  ·  view source on GitHub ↗

* Invoke all handlers for the given type. * If present, `'*'` handlers are invoked after type-matched handlers. * * Note: Manually firing '*' handlers is not supported. * * @param {string|symbol} type The event type to invoke * @param {Any} [evt] Any value (object is recommended an

(type: Key, evt?: Events[Key])

Source from the content-addressed store, hash-verified

101 * @memberOf mitt
102 */
103 emit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {
104 let handlers = all!.get(type);
105 if (handlers) {
106 (handlers as EventHandlerList<Events[keyof Events]>)
107 .slice()
108 .map((handler) => {
109 handler(evt!);
110 });
111 }
112
113 handlers = all!.get('*');
114 if (handlers) {
115 (handlers as WildCardEventHandlerList<Events>)
116 .slice()
117 .map((handler) => {
118 handler(type, evt!);
119 });
120 }
121 }
122 };
123}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…