Open History to see the last commit
1export function connectTestEventBus(): () => void {
2 const handleConnect = () => {
3 window.dispatchEvent(new CustomEvent('tanstack-connect-success'))
4 }
5 const handleDispatch = (event: Event) => {
6 const payload = (event as CustomEvent).detail
7 window.dispatchEvent(new CustomEvent(payload.type, { detail: payload }))
8 }
9β
10 window.addEventListener('tanstack-connect', handleConnect)
11 window.addEventListener('tanstack-dispatch-event', handleDispatch)
12β
13 return () => {
14 window.removeEventListener('tanstack-connect', handleConnect)
15 window.removeEventListener('tanstack-dispatch-event', handleDispatch)
16 }
17}