Open History to see the last commit
1import { createContext, useContext } from 'solid-js'
2import type { DevtoolsOfflineState } from './types'
3β
4export const DevtoolsOfflineContext = createContext<DevtoolsOfflineState>()
5β
6/**
7 * Returns the devtools offline state provided by `DevtoolsOfflineProvider`.
8 *
9 * @returns The offline state.
10 * @throws {Error} If there is no `DevtoolsOfflineProvider` above.
11 */
12export function useDevtoolsOffline() {
13 const state = useContext(DevtoolsOfflineContext)
14 if (!state) throw new Error('Missing DevtoolsOfflineProvider')
15 return state
16}