Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UndoList

Records operations that may be undone or redone. It maintains a single list of Undo objects in the order by which they are passed to the UndoList.record method.

This object maintains a single history. So if operations A, B, C, D are recorded, C and D are undone and then E is recorded, the list of recorded operations will then be A, B, E.

Hierarchy

  • UndoList

Index

Properties

Private _events

_events: Subject<UndoEvents> = new Subject()

Private _undoingOrRedoing

_undoingOrRedoing: boolean = false

events

events: Observable<UndoEvents> = this._events.asObservable()

Private index

index: number = -1

Private list

list: ListItem[] = []

Private stack

stack: UndoGroup[] = []

Methods

canRedo

  • canRedo(): boolean
  • Returns boolean

    True if there is something to redo, false otherwise.

canUndo

  • canUndo(): boolean
  • Returns boolean

    True if there is something to undo, false otherwise.

endAllGroups

  • endAllGroups(): void
  • Ends all groups currently in effect. This is the same as calling endGroup repeatedly until there are no more groups to end.

    Returns void

endGroup

  • endGroup(): void
  • Ends recording a group of undo operations. The group currently in effect is terminated, and made the last recorded operation (as if it had been passed to UndoList.record).

    throws

    {Error} If there is no current undo group.

    Returns void

getGroup

record

  • record(obj: Undo): void
  • This method makes the UndoList object record the object passed to it. Any operations that had previously been undone are forgotten.

    Parameters

    • obj: Undo

      An undo object to record.

    Returns void

redo

  • redo(): void
  • Redoes the latest Undo object that was undone. It is an error to call this method or undo from within this method. Does nothing if there is nothing to redo.

    throws

    {Error} If an undo is attempted when an undo or redo is already in progress.

    Returns void

reset

  • reset(): void
  • Reset the list to its initial state without undoing operations. The list effectively forgets old undo operations.

    Returns void

startGroup

  • Starts recording a group of undo operations.

    Parameters

    Returns void

toString

  • toString(): string
  • Returns string

    A string showing all the undo steps and undo groups stored in this undo list.

undo

  • undo(): void
  • Undoes the latest Undo that was recorded. If any UndoGroup objects were in effect when called, they are terminated. It is an error to call this method or redo from within this method. Does nothing if there is nothing to undo.

    throws

    {Error} If an undo is attempted when an undo or redo is already in progress.

    Returns void

undoingOrRedoing

  • undoingOrRedoing(): boolean
  • Returns boolean

    True if the object is in the midst of undoing or redoing, false otherwise.

Generated using TypeDoc