Skip to content
Source
Sign inSign up
samwillis/neon-realtime-electric
Open History to see the last commit

main.tsx

19 lines625 Bytes

1import { createRoot } from 'react-dom/client'
2import { abort } from './shared'
3​
4const mode =
5 new URLSearchParams(location.search).get('mode')?.replace(/-sse$/, '') ??
6 'basic'
7window.addEventListener('pagehide', () => abort.abort())
8async function start() {
9 const View =
10 mode === 'custom'
11 ? (await import('./basic/custom')).CustomBasic
12 : mode === 'react'
13 ? (await import('./react')).ReactShape
14 : mode === 'tanstack'
15 ? (await import('./tanstack')).TanStack
16 : (await import('./basic')).Basic
17 createRoot(document.getElementById('app')!).render(<View />)
19void start()