Skip to main content

Class: InMemoryHistory

Implements command history which stores all commands in memory.

Implements

Constructors

new InMemoryHistory()

new InMemoryHistory(): InMemoryHistory

Returns

InMemoryHistory

Properties

PropertyModifierTypeDescription

events

readonly

Events<CommandHistoryEvents>

Events for the command history.

Accessors

redoStack

get redoStack(): 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.

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

CommandHistory.redoStack

Defined in

diagram/history.ts:269


undoStack

get undoStack(): readonly Command[]

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

CommandHistory.undoStack

Defined in

diagram/history.ts:265

Methods

execute()

execute(command): void

Executes the specified command and puts its inverse into undo stack.

Parameters

ParameterType

command

Command

Returns

void

Implementation of

CommandHistory.execute

Defined in

diagram/history.ts:301


redo()

redo(): void

Redoes (performs again) the latest undone command.

If redo stack is empty, does nothing.

Returns

void

Implementation of

CommandHistory.redo

Defined in

diagram/history.ts:292


registerToUndo()

registerToUndo(command): void

Puts the inverse command directly into undo stack.

Parameters

ParameterType

command

Command

Returns

void

Implementation of

CommandHistory.registerToUndo

Defined in

diagram/history.ts:306


reset()

reset(): void

Clears undo and redo stacks of commands.

Returns

void

Implementation of

CommandHistory.reset

Defined in

diagram/history.ts:277


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

ParameterType

title?

string | TranslatedText

Returns

CommandBatch

Implementation of

CommandHistory.startBatch

Defined in

diagram/history.ts:321


undo()

undo(): void

Undoes (reverts) the latest executed command and puts it into redo stack.

If undo stack is empty, does nothing.

Returns

void

Implementation of

CommandHistory.undo

Defined in

diagram/history.ts:283