MCPcopy Index your code
hub / github.com/Sandpack/nodebox-runtime / on

Method on

packages/nodebox/src/messages.ts:274–290  ·  view source on GitHub ↗
(
    event: Event,
    listener: (message: MessageEvent<WorkerEvents[Event]>) => void,
    options?: AddEventListenerOptions
  )

Source from the content-addressed store, hash-verified

272 }
273
274 public on<Event extends keyof WorkerEvents & string>(
275 event: Event,
276 listener: (message: MessageEvent<WorkerEvents[Event]>) => void,
277 options?: AddEventListenerOptions
278 ): void {
279 debug('[message-sender]: add listener "%s"', event);
280
281 this.emitter.addEventListener(
282 event,
283 (message) => {
284 if (message instanceof MessageEvent) {
285 listener(message);
286 }
287 },
288 options
289 );
290 }
291
292 public off<Event extends keyof WorkerEvents & string>(
293 event: Event,

Callers 15

handshakeMethod · 0.95
sendMethod · 0.95
connectMethod · 0.45
next.start.test.tsFile · 0.45
spawnAndWaitForStdoutFunction · 0.45
console.test.tsFile · 0.45
nuxt.example.jsFile · 0.45
astro.example.jsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected