| 25 | eventBus: { stop: () => void } |
| 26 | } |
| 27 | |
| 28 | export function mountDevtools(options: MountOptions): MountResult { |
| 29 | const { el, plugins, config, eventBusConfig, onSetPlugins } = options |
| 30 | |
| 31 | const eventBus = new ClientEventBus(eventBusConfig) |
| 32 | eventBus.start() |
| 33 | |
| 34 | // Loaded by hand rather than with `lazy`, which would need a `Loading` |
| 35 | // boundary to keep the root from waiting on the chunk. |
| 36 | const [devtools, setDevtools] = createSignal<Component>() |
| 37 | void import('./devtools').then((mod) => setDevtools(() => mod.default)) |
| 38 | |
| 39 | const dispose = render( |
| 40 | () => ( |
| 41 | <DevtoolsProvider |
| 42 | plugins={plugins} |
| 43 | config={config} |
| 44 | onSetPlugins={onSetPlugins} |
| 45 | > |
| 46 | <PiPProvider> |
| 47 | <Portal mount={el}> |
| 48 | {/* Set once, when the chunk arrives. */} |
| 49 | <Show when={devtools()} keyed> |
| 50 | {(Shell) => createComponent(Shell, {})} |
| 51 | </Show> |
| 52 | </Portal> |
| 53 | </PiPProvider> |
| 54 | </DevtoolsProvider> |
| 55 | ), |
| 56 | el, |