Options
All
  • Public
  • Public/Protected
  • All
Menu

An UndoTransaction is used to group one or more undo operations into a single item in the undo/redo history. Multiple undo operations can be added to a transaction's private stack. When a transaction is committed, the whole transaction will be pushed to the top of the undo stack of the UndoManager. Rolling back a transaction will invoke all contained undo operations, but they won't be pushed to the undo history of the UndoManager.

Hierarchy

  • UndoTransaction

Implements

Index

Constructors

constructor

Properties

changes

changes: Undoable[]

The list of changes collected during a transaction. The changes are stored in order of occurrence. You should not modify this list.

displayName

displayName: string

Details about the operation, for example: "Update" may be the display name for an edit operation that updates features.

owner

The TransactionManager for this transaction.

parentTransaction

parentTransaction: UndoTransaction

The parent transaction containing this instance. The value will be null for top-level transactions.

state

state: any

User state object

transactionStatus

transactionStatus: string

The status of this transaction (e.g. None, Committed, Aborted)

Methods

Protected _wrapInTransaction

  • Parameters

    • name: string
    • undoable: Undoable
    • Optional state: any

    Returns UndoTransaction

add

  • add(name: string, undoable: Undoable, state?: any): void
  • Records an undo operation as part of this transaction. Transactions are undone (or redone) as a single atomic operation.

    Parameters

    • name: string
    • undoable: Undoable

      The undo operation to record within this transaction.

    • Optional state: any

    Returns void

commit

  • commit(): Promise<void>
  • Commits the undo operation of this UndoTransaction

    Returns Promise<void>

hasChanges

  • hasChanges(): boolean
  • Returns a boolean value indicating whether any undo operations have been recorded for this transaction.

    Returns boolean

isAborted

  • isAborted(): boolean
  • Whether this transaction was aborted (rolled back)

    Returns boolean

isCommitted

  • isCommitted(): boolean
  • Whether this transaction was committed.

    Returns boolean

isComplete

  • isComplete(): boolean
  • Whether we can add more undo operations to the list of changes for this transaction.

    Returns boolean

isTopLevel

  • isTopLevel(): boolean
  • Whether this is a top-level transaction. Top-level transactions have no parent and thus are not nested.

    Returns boolean

performRedo

  • Invokes the performRedo method for all contained Undoables in the order in which they were added.

    Parameters

    Returns Promise<void>

performUndo

  • Invokes the performUndo method for all contained Undoables in the reverse of the order in which they were added.

    Parameters

    Returns Promise<void>

rollback

  • rollback(): Promise<void>
  • Rolls back (aborts) the transaction and calls the undo operations to recover the state before the UndoTransaction was created.

    Returns Promise<void>