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

Method emit

packages/event-bus-client/src/plugin.ts:193–235  ·  view source on GitHub ↗
(
    eventSuffix: TEvent,
    payload: TEventMap[TEvent],
  )

Source from the content-addressed store, hash-verified

191 }
192 }
193 emit<TEvent extends keyof TEventMap & string>(
194 eventSuffix: TEvent,
195 payload: TEventMap[TEvent],
196 ) {
197 if (!this.#enabled) {
198 this.debugLog(
199 'Event bus client is disabled, not emitting event',
200 eventSuffix,
201 payload,
202 )
203 return
204 }
205 if (this.#internalEventTarget) {
206 this.debugLog(
207 'Emitting event to internal event target',
208 eventSuffix,
209 payload,
210 )
211 this.#internalEventTarget.dispatchEvent(
212 new CustomEvent(`${this.#pluginId}:${eventSuffix}`, {
213 detail: this.createEventPayload(eventSuffix, payload),
214 }),
215 )
216 }
217
218 if (this.#failedToConnect) {
219 this.debugLog('Previously failed to connect, not emitting to bus')
220 return
221 }
222 // wait to connect to the bus
223 if (!this.#connected) {
224 this.debugLog('Bus not available, will be pushed as soon as connected')
225 this.#queuedEvents.push(this.createEventPayload(eventSuffix, payload))
226 // start connection to event bus
227 if (typeof CustomEvent !== 'undefined' && !this.#connecting) {
228 this.#connectFunction()
229 this.startConnectLoop()
230 }
231 return
232 }
233 // emit right now
234 return this.emitEventToBus(this.createEventPayload(eventSuffix, payload))
235 }
236
237 on<TEvent extends keyof TEventMap & string>(
238 eventSuffix: TEvent,

Callers 15

configureServerFunction · 0.45
handleHotUpdateFunction · 0.45
installPackageFunction · 0.45
emitOutdatedDepsFunction · 0.45
utils.test.tsFile · 0.45
toggleOpenFunction · 0.45
requestPackageJsonFunction · 0.45
handleActionFunction · 0.45
index.test.tsFile · 0.45
noop.test.tsFile · 0.45
createCounterFunction · 0.45
emitServerEventFunction · 0.45

Calls 4

debugLogMethod · 0.95
createEventPayloadMethod · 0.95
startConnectLoopMethod · 0.95
emitEventToBusMethod · 0.95

Tested by

no test coverage detected