Download react-query/packages/query-devtools/src/contexts/QueryDevtoolsContext.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.2 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/query-devtools/src/contexts/QueryDevtoolsContext.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/query-devtools/src/contexts/QueryDevtoolsContext.ts
-
curl -L -o QueryDevtoolsContext.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/query-devtools/src/contexts/QueryDevtoolsContext.ts
1.2 kB
| import { createContext, useContext } from 'solid-js' | |
| import type { Query, QueryClient, onlineManager } from '@tanstack/query-core' | |
| type XPosition = 'left' | 'right' | |
| type YPosition = 'top' | 'bottom' | |
| export type DevtoolsPosition = XPosition | YPosition | |
| export type DevtoolsButtonPosition = `${YPosition}-${XPosition}` | 'relative' | |
| export interface DevtoolsErrorType { | |
| /** | |
| * The name of the error. | |
| */ | |
| name: string | |
| /** | |
| * How the error is initialized. | |
| */ | |
| initializer: (query: Query) => Error | |
| } | |
| export interface QueryDevtoolsProps { | |
| readonly client: QueryClient | |
| queryFlavor: string | |
| version: string | |
| onlineManager: typeof onlineManager | |
| buttonPosition?: DevtoolsButtonPosition | |
| position?: DevtoolsPosition | |
| initialIsOpen?: boolean | |
| errorTypes?: Array<DevtoolsErrorType> | |
| shadowDOMTarget?: ShadowRoot | |
| onClose?: () => unknown | |
| } | |
| export const QueryDevtoolsContext = createContext<QueryDevtoolsProps>({ | |
| client: undefined as unknown as QueryClient, | |
| onlineManager: undefined as unknown as typeof onlineManager, | |
| queryFlavor: '', | |
| version: '', | |
| shadowDOMTarget: undefined, | |
| }) | |
| export function useQueryDevtoolsContext() { | |
| return useContext(QueryDevtoolsContext) | |
| } | |