Class: InMemoryHistory
Implements command history which stores all commands in memory.
Implements
Constructors
new InMemoryHistory()
new InMemoryHistory():
InMemoryHistory
Returns
Properties
Property | Modifier | Type | Description |
---|---|---|---|
|
| Events for the command history. |
Accessors
redoStack
get
redoStack(): readonlyCommand
[]
Current stack of operation which could be redone (performed again after being undone).
Latest undone commands are put at the end of the stack.
Returns
readonly Command
[]
Current stack of operation which could be redone (performed again after being undone).
Latest undone commands are put at the end of the stack.
Implementation of
Defined in
undoStack
get
undoStack(): readonlyCommand
[]
Current stack of operation which could be undone (reverted).
Latest executed (or redone) commands are put at the end of the stack.
Returns
readonly Command
[]
Current stack of operation which could be undone (reverted).
Latest executed (or redone) commands are put at the end of the stack.
Implementation of
Defined in
Methods
execute()
execute(
command
):void
Executes the specified command and puts its inverse into undo stack.
Parameters
Parameter | Type |
---|---|
|
Returns
void
Implementation of
Defined in
redo()
redo():
void
Redoes (performs again) the latest undone command.
If redo stack is empty, does nothing.
Returns
void
Implementation of
Defined in
registerToUndo()
registerToUndo(
command
):void
Puts the inverse command directly into undo stack.
Parameters
Parameter | Type |
---|---|
|
Returns
void
Implementation of
Defined in
reset()
reset():
void
Clears undo and redo stacks of commands.
Returns
void
Implementation of
Defined in
startBatch()
startBatch(
title
?):CommandBatch
Starts a new command batch which will be active either stored or discarded.
When a batch is active, all executed or registered to undo commands will be put into the batch instead of the undo stack, so it could be undo as whole later.
Starting a new batch when there is an active command batch already causes the new batch to become nested, which allows to use operations creating command batches as part of a larger operation having its own top-level batch.
Parameters
Parameter | Type |
---|---|
|
|
Returns
Implementation of
Defined in
undo()
undo():
void
Undoes (reverts) the latest executed command and puts it into redo stack.
If undo stack is empty, does nothing.
Returns
void