| 25 | } |
| 26 | |
| 27 | export function mountDevtools(options: MountOptions): MountResult { |
| 28 | const { el, plugins, config, eventBusConfig, onSetPlugins } = options |
| 29 | |
| 30 | const eventBus = new ClientEventBus(eventBusConfig) |
| 31 | eventBus.start() |
| 32 | |
| 33 | const Devtools = lazy(() => import('./devtools')) |
| 34 | |
| 35 | const dispose = render( |
| 36 | () => ( |
| 37 | <DevtoolsProvider |
| 38 | plugins={plugins} |
| 39 | config={config} |
| 40 | onSetPlugins={onSetPlugins} |
| 41 | > |
| 42 | <PiPProvider> |
| 43 | <Portal mount={el}> |
| 44 | <Devtools /> |
| 45 | </Portal> |
| 46 | </PiPProvider> |
| 47 | </DevtoolsProvider> |
| 48 | ), |
| 49 | el, |
| 50 | ) |
| 51 | |
| 52 | return { dispose, eventBus } |
| 53 | } |