(cb: (event: AllDevtoolsEvents<TEventMap>) => void)
| 291 | ) |
| 292 | } |
| 293 | onAllPluginEvents(cb: (event: AllDevtoolsEvents<TEventMap>) => void) { |
| 294 | if (!this.#enabled) { |
| 295 | this.debugLog('Event bus client is disabled, not registering event') |
| 296 | return () => {} |
| 297 | } |
| 298 | const handler = (e: Event) => { |
| 299 | const event = (e as CustomEvent).detail |
| 300 | if (this.#pluginId && event.pluginId !== this.#pluginId) { |
| 301 | return |
| 302 | } |
| 303 | cb(event) |
| 304 | } |
| 305 | this.#eventTarget().addEventListener('tanstack-devtools-global', handler) |
| 306 | return () => |
| 307 | this.#eventTarget().removeEventListener( |
| 308 | 'tanstack-devtools-global', |
| 309 | handler, |
| 310 | ) |
| 311 | } |
| 312 | } |
no test coverage detected