DWVv0.37.0

UndoStack

Source: undoStack.js:26

UndoStack class.


Constructor

new UndoStack(): UndoStack

Instance Methods

getStackSize(): number

Get the stack size.

Returns

  • number — The size of the stack.

getCurrentStackIndex(): number

Get the current stack index. Warning: 1 based.

Returns

  • number — The stack index.

getCurrentCommand(): Command

Get the current command.

Returns

add(cmd: Command)

Add a command to the stack.

Parameters

  • cmd (Command) — The command to add.

Fires

  • UndoStack#event:undoadd

remove(name: string): boolean

Remove a command from the stack.

Parameters

  • name (string) — The name of the command to remove.

Returns

  • boolean — True if the command was found and removed.

Fires

  • UndoStack#event:undoremove

undo()

Undo the last command.

Fires

  • UndoStack#event:undo

redo()

Redo the last command.

Fires

  • UndoStack#event:redo

Events

undoadd: Event

Add command to undo stack event.

undoremove: CustomEvent

Remove command from undo stack event. Get the removed command name from the event.detail.

undo: Event

Command undo event.

redo: Event

Command redo event.