Open History to see the last commit
1import { createContext, useContext } from 'solid-js'
2β
3export const ShadowDomTargetContext = createContext<ShadowRoot | undefined>(
4 undefined,
5)
6β
7export const DevtoolsOnCloseContext = createContext<
8 | {
9 onCloseClick: (
10 e: MouseEvent & { currentTarget: HTMLButtonElement; target: Element },
11 ) => void
12 }
13 | undefined
14>(undefined)
15β
16export const useDevtoolsOnClose = () => {
17 const context = useContext(DevtoolsOnCloseContext)
18 if (!context) {
19 throw new Error(
20 'useDevtoolsOnClose must be used within a TanStackRouterDevtools component',
21 )
22 }
23 return context
24}