UndoStack

UndoStack class.

Constructor

new UndoStack()

Methods

add(cmd)

Add a command to the stack.

Parameters:
NameTypeDescription
cmdobject

The command to add.

getCurrentCommand() → {object}

Get the current command.

Returns:

The command.

Type: 
object

getCurrentStackIndex() → {number}

Get the current stack index. Warning: 1 based.

Returns:

The stack index.

Type: 
number

getStackSize() → {number}

Get the stack size.

Returns:

The size of the stack.

Type: 
number

redo()

Redo the last command.

remove(name) → {boolean}

Remove a command from the stack.

Parameters:
NameTypeDescription
namestring

The name of the command to remove.

Returns:

True if the command was found and removed.

Type: 
boolean

undo()

Undo the last command.

Events

redo

Command redo event. event.target.getCurrentCommand() will return the re-done command.

Type:
  • Event

undo

Command undo event. event.target.getCurrentCommand() will return the undone command.

Type:
  • Event

undoadd

Add command to undo stack event. event.target.getCurrentCommand() will return the added command.

Type:
  • Event

undoremove

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

Type:
  • CustomEvent