react-query
Version:
Hooks for managing, caching and syncing asynchronous and remote data in React
23 lines (22 loc) • 867 B
TypeScript
import { PersistedClient, Persister } from '../persistQueryClient';
interface CreateWebStoragePersisterOptions {
/** The storage client used for setting an retrieving items from cache */
storage: Storage;
/** The key to use when storing the cache */
key?: string;
/** To avoid spamming,
* pass a time in ms to throttle saving the cache to disk */
throttleTime?: number;
/**
* How to serialize the data to storage.
* @default `JSON.stringify`
*/
serialize?: (client: PersistedClient) => string;
/**
* How to deserialize the data from storage.
* @default `JSON.parse`
*/
deserialize?: (cachedString: string) => PersistedClient;
}
export declare function createWebStoragePersister({ storage, key, throttleTime, serialize, deserialize, }: CreateWebStoragePersisterOptions): Persister;
export {};