historyState
Category States
A reactive state that tracks its change history. Provides undo and redo capabilities as well as access to the histories.
Demo
Search history
Empty...
Type definitions
import { type TrackHistoryOptions, type TrackHistoryReturn } from '../../reactivity/index.js';
type HistoryStateOptions = TrackHistoryOptions;
type HistoryStateReturn<T> = TrackHistoryReturn<T> & {
current: T;
};
/**
* A reactive state that allows for undo and redo operations by tracking the change history.
* @param initial The initial value of the state.
* @see https://svelte-librarian.github.io/sv-use/docs/core/states/history-state
*/
export declare function historyState<T>(initial: T, options?: HistoryStateOptions): HistoryStateReturn<T>;
export {};