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

Function onOneOf

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

Source from the content-addressed store, hash-verified

58 }
59
60 function onOneOf<N extends keyof EventsMap>(
61 names: N[],
62 handler: EventHandler<EventsMap[N]>
63 ) {
64 const cleanup = createCleanupObject();
65
66 for (const name of names) {
67 cleanup.next = on(name, handler);
68 }
69
70 return () => {
71 cleanup.clean();
72 };
73 }
74
75 function hasListeners<N extends keyof EventsMap>(name: N) {
76 return !!subscribersMap.get(name)?.size;

Callers

nothing calls this directly

Calls 2

createCleanupObjectFunction · 0.90
onFunction · 0.85

Tested by

no test coverage detected