MCPcopy
hub / github.com/srcbookdev/srcbook / on

Method on

packages/web/src/clients/websocket/channel.ts:94–97  ·  view source on GitHub ↗
(event: K, callback: (payload: z.TypeOf<I[K]>) => void)

Source from the content-addressed store, hash-verified

92 }
93
94 on<K extends keyof I & string>(event: K, callback: (payload: z.TypeOf<I[K]>) => void): void {
95 this.callbacks[event] = this.callbacks[event] || [];
96 this.callbacks[event]?.push(callback);
97 }
98
99 off<K extends keyof I & string>(event: K, callback: (payload: z.TypeOf<I[K]>) => void): void {
100 const callbacks = (this.callbacks[event] || []).filter((cb) => cb !== callback);

Callers 9

configureServerFunction · 0.45
PackageJsonProviderFunction · 0.45
ControlledCodeCellFunction · 0.45
onGetDefinitionContentsFunction · 0.45
mountFunction · 0.45
getCompletionsFunction · 0.45
TsconfigJsonFunction · 0.45
SessionFunction · 0.45
subscribeMethod · 0.45

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected