UNPKG

swr-vue

Version:

Vue composables for Data fetching

68 lines (67 loc) 3.18 kB
import { MaybeRef } from '@vueuse/core'; import { CacheState, Key, SWRConfig } from '../../types'; export declare type MutateOptions = { optimisticData?: unknown; rollbackOnError?: boolean; revalidate?: boolean; }; export declare const useSWRConfig: () => { config: Readonly<import("vue").Ref<{ readonly cacheProvider: { readonly entries: () => IterableIterator<[string, CacheState]>; readonly keys: () => IterableIterator<string>; readonly has: (key: Key) => boolean; readonly get: (key: Key) => CacheState | undefined; readonly set: (key: Key, value: import('../../types').DeepMaybeRef<CacheState>) => void; readonly delete: (key: Key) => void; readonly clear: () => void; }; readonly revalidateOnFocus: boolean; readonly revalidateOnReconnect: boolean; readonly revalidateIfStale: boolean; readonly dedupingInterval: number; readonly refreshInterval: number; readonly refreshWhenHidden: boolean; readonly refreshWhenOffline: boolean; readonly focusThrottleInterval: number; readonly fallback?: { readonly [x: string]: any; } | undefined; readonly fallbackData?: any; readonly onSuccess?: ((data: any, key: string, config: SWRConfig<any, any>) => void) | undefined; readonly onError?: ((err: any, key: string, config: SWRConfig<any, any>) => void) | undefined; }>>; mutate: <U extends unknown>(_key: Key, updateFnOrPromise?: U | undefined, options?: MutateOptions) => Promise<any>; }; export declare const configureGlobalSWR: (config: MaybeRef<Partial<SWRConfig>>) => void; /** * @deprecated use `useSWRConfig` instead */ export declare const useGlobalSWRConfig: () => { globalConfig: Readonly<import("vue").Ref<{ readonly cacheProvider: { readonly entries: () => IterableIterator<[string, CacheState]>; readonly keys: () => IterableIterator<string>; readonly has: (key: Key) => boolean; readonly get: (key: Key) => CacheState | undefined; readonly set: (key: Key, value: import('../../types').DeepMaybeRef<CacheState>) => void; readonly delete: (key: Key) => void; readonly clear: () => void; }; readonly revalidateOnFocus: boolean; readonly revalidateOnReconnect: boolean; readonly revalidateIfStale: boolean; readonly dedupingInterval: number; readonly refreshInterval: number; readonly refreshWhenHidden: boolean; readonly refreshWhenOffline: boolean; readonly focusThrottleInterval: number; readonly fallback?: { readonly [x: string]: any; } | undefined; readonly fallbackData?: any; readonly onSuccess?: ((data: any, key: string, config: SWRConfig<any, any>) => void) | undefined; readonly onError?: ((err: any, key: string, config: SWRConfig<any, any>) => void) | undefined; }>>; mutate: <U extends unknown>(_key: Key, updateFnOrPromise?: U | undefined, options?: MutateOptions) => Promise<any>; };