MCPcopy Create free account
hub / github.com/clientdb/clientdb / on

Function on

core/utils/eventManager.ts:47–58  ·  view source on GitHub ↗
(
    name: N,
    handler: EventHandler<EventsMap[N]>
  )

Source from the content-addressed store, hash-verified

45 }
46
47 function on<N extends keyof EventsMap>(
48 name: N,
49 handler: EventHandler<EventsMap[N]>
50 ) {
51 const listeners = getHandlersForEvent(name);
52
53 listeners.add(handler);
54
55 return () => {
56 listeners.delete(handler);
57 };
58 }
59
60 function onOneOf<N extends keyof EventsMap>(
61 names: N[],

Callers 1

onOneOfFunction · 0.85

Calls 2

getHandlersForEventFunction · 0.85
addMethod · 0.80

Tested by

no test coverage detected