HistoryManager

Command-pattern undo/redo history manager. Each command is a plain object: { label: string, undo: () => void|Promise, redo: () => void|Promise, dirtyFlags: string[] } dirtyFlags values: 'transcript' | 'speakers' | 'annotations' | 'projectName' | 'projectFolder'

Constructor

new HistoryManager(optionsopt)

Parameters:
NameTypeAttributesDescription
optionsobject<optional>
Optional configuration.
Properties
NameTypeAttributesDefaultDescription
maxSizenumber<optional>
100Maximum number of commands to retain in the undo stack.

Classes

HistoryManager

Members

canRedo

canUndo

Methods

clear()

Clears both stacks.

push(command)

Pushes a command onto the undo stack and clears the redo stack.
Parameters:
NameTypeDescription
commandobjectThe command object with undo, redo, label, and dirtyFlags properties.

(async) redo() → {Promise.<(object|null)>}

Redoes the most recently undone command. Returns the command after awaiting redo().
Returns:
Type: 
Promise.<(object|null)>

(async) undo() → {Promise.<(object|null)>}

Undoes the most recent command. Returns the command after awaiting undo().
Returns:
Type: 
Promise.<(object|null)>