MCPcopy Index your code
hub / github.com/TanStack/devtools / emitToClients

Method emitToClients

packages/event-bus/src/client/client.ts:113–131  ·  view source on GitHub ↗
(
    event: TanStackDevtoolsEvent<string>,
    fromBroadcastChannel = false,
  )

Source from the content-addressed store, hash-verified

111 }
112
113 private emitToClients(
114 event: TanStackDevtoolsEvent<string>,
115 fromBroadcastChannel = false,
116 ) {
117 this.debugLog('Emitting event from client bus', event)
118 const specificEvent = new CustomEvent(event.type, { detail: event })
119 this.debugLog('Emitting event to specific client listeners', event)
120 this.#eventTarget.dispatchEvent(specificEvent)
121 const globalEvent = new CustomEvent('tanstack-devtools-global', {
122 detail: event,
123 })
124 // We only emit the events if they didn't come from the broadcast channel
125 // otherwise it would infinitely send events between
126 if (!fromBroadcastChannel) {
127 this.#broadcastChannel?.postMessage(stringifyWithBigInt(event))
128 }
129 this.debugLog('Emitting event to global client listeners', event)
130 this.#eventTarget.dispatchEvent(globalEvent)
131 }
132
133 private flushPendingServerEvents() {
134 if (!this.#socket || this.#socket.readyState !== WebSocket.OPEN) {

Callers 3

ClientEventBusClass · 0.95
constructorMethod · 0.95
handleEventReceivedMethod · 0.95

Calls 2

debugLogMethod · 0.95
stringifyWithBigIntFunction · 0.90

Tested by

no test coverage detected