persistnsync
Version:
Zustand middleware to easily persist and sync Zustand state between tabs and windows
17 lines (16 loc) • 641 B
TypeScript
import { StateCreator } from "zustand";
export type StorageType = "localStorage" | "sessionStorage" | "cookies";
export interface PersistNSyncOptionsType {
name: string;
/** @deprecated */
regExpToIgnore?: RegExp;
include?: (string | RegExp)[];
exclude?: (string | RegExp)[];
storage?: StorageType;
/** @defaultValue 100 */
initDelay?: number;
}
type PersistNSyncType = <T>(f: StateCreator<T, [], []>, options: PersistNSyncOptionsType) => StateCreator<T, [], []>;
export declare function clearStorage(name: string, storage?: StorageType): void;
export declare const persistNSync: PersistNSyncType;
export {};