Go to repository

Interface Undoable

An Undoable is a data structure that changes over time, and incorporates the possibility to undo some changes and later redo them (if no other changing operation was done in between).

Changes already made can be undone with undo, but those undone changes can be redone with redo if no other changing operation was made in between. Information about the number of possible undos or redos that are available can be obtained with numUndos and numRedos.

interface Undoable {
    numRedos(): number;
    numUndos(): number;
    redo(): void;
    undo(): void;
}

Implemented by

API

Describe the number of redos that can be performed on the current value.

Returns number

Describe the number of undos that can be performed on the current value.

Returns number

Redo the next change, if there is some undone. If there are no changes to redo, do nothing. After a change in the current value, all possible occurrences of redo are lost.

Returns void

Undo the last change made, leaving the possibility to recover it later, if no other operation changing the value occurs in between. If there are no changes to undo, do nothing.

Returns void