UNPKG

@minimaltech/ra-infra

Version:

Minimal Technology ReactJS Infrastructure

25 lines (24 loc) 668 B
export interface IUseAutosaveParams<TData, TReturn> { /** * The controlled form value to be auto saved */ data: TData; /** * Callback function to save data */ onSave: (data: TData) => Promise<TReturn> | TReturn | void; /** * The number of milliseconds between save attempts * @default 2000 */ interval?: number; /** * Set to false if you do not want the save function to fire on unmount */ enableSaveOnUnmount?: boolean; /** * Disable autosave */ disabled?: boolean; } export declare const useAutosave: <TData, TReturn>(params: IUseAutosaveParams<TData, TReturn>) => void;