Interface ITransaction

interface ITransaction {
    depth: number;
    description: string;
    isUndo: boolean;
    uuid: string;
    beginTransaction(description?, onClose?, isUndo?): ITransaction;
    commit(): ITransaction;
    getChangeSet<STATE, INPUTS>(record): ChangeSet<STATE, INPUTS>;
    getState<STATE>(record): STATE;
    parent(): ITransaction;
    rollback(): ITransaction;
    updateState<STATE, INPUTS>(options): ChangeSet<STATE, INPUTS>;
}

Implemented by

Properties

depth: number
description: string
isUndo: boolean
uuid: string

unique id for this transaction. This will be the same id for all sub transactions.

Methods

  • Begin a transaction with self contained, non-eventing updates

    Parameters

    • Optional description: string

      The description of the transaction

    • Optional onClose: ((transaction) => void)

      A callback for when the transaction is closed (due to either a commit or rollback)

        • (transaction): void
        • Parameters

          Returns void

    • Optional isUndo: boolean

      A hint to indicate if the transaction should be support undo.

    Returns ITransaction

    Remarks

    Context is useful for debugging and logging. This is treated as a stack so it's fifo. This means that when finally committed to global changeset that only the final context will be maintained.

  • Commit the transaction and all children transactions to the parent changeset.

    Returns ITransaction

  • Type Parameters

    • STATE = any

    Parameters

    • record: any

    Returns STATE