UNPKG

jotai-history-global

Version:

Lightweight global undo/redo extension for Jotai. / 为 Jotai 提供全局撤销、重做功能的轻量扩展。

23 lines (22 loc) 828 B
/** * atomWithHistory * * Creates a Jotai atom that tracks its history for undo/redo operations */ import type { AtomWithHistory, AtomWithHistoryOptions } from './types'; /** * Creates an atom with history tracking * * @param initialValue - The initial value of the atom * @param options - Configuration options * @returns An atom that tracks its history */ export declare function atomWithHistory<Value>(initialValue: Value, options?: AtomWithHistoryOptions<Value>): AtomWithHistory<Value>; /** * Function to read an atom's value from the history store directly */ export declare function getAtomValue<Value>(atom: AtomWithHistory<Value>): Value; /** * Function to set an atom's value in the history store directly */ export declare function setAtomValue<Value>(atom: AtomWithHistory<Value>, value: Value): void;