fn

createHistory

tested

Signature

ts
export function createHistory(options: HistoryOptions ={ ... }

Parameters

ParameterTypeDescription
options?HistoryOptions—

Returns

History
PropertyTypeDescription
record(entry: HistoryEntry) => voidRecord a new edit, clearing the redo stack.
interrupt() => voidBreak the coalescing chain: the next recorded entry starts its own group. Called for anything that lands between recordings (a remote change, an undo/redo, a selection jump) — merging across such a boundary would splice foreign state into one undo press.
undo() => HistoryEntry | undefinedPop the latest undo entry (and push it onto the redo stack).
redo() => HistoryEntry | undefinedPop the latest redo entry (and push it back onto the undo stack).
canUndo() => boolean—
canRedo() => boolean—
clear() => void—