SheetXL - v0.3.20
    Preparing search index...

    Interface ITransaction

    Objects that implement this interface have ACID properties.

    interface ITransaction {
        beginTransaction(
            options?: StoreOperationOptions,
            onClose?: CloseCallback,
        ): ITransaction;
        commit<View = any, P = any>(
            options?: StoreOperationOptions<View, P>,
        ): ITransaction;
        getDepth(): number;
        getDescription(): string;
        getId(): string;
        getParent(): ITransaction;
        getState<STATE = any>(model: any): Readonly<STATE>;
        getStates(): Map<any, any>;
        getView(): Record<string, any>;
        rollback(): ITransaction;
        updateState<STATE = any>(
            model: any,
            state:
                | Readonly<Partial<STATE>>
                | ((prev: Readonly<STATE>) => Readonly<STATE>),
        ): STATE;
    }
    Index

    Methods

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

      Parameters

      • Optionaloptions: StoreOperationOptions

        The description of the transaction or options.

      • OptionalonClose: CloseCallback

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

      Returns ITransaction

      description is useful for debugging and logging.

      Transactions are treated as a stack so with fifo remove. When the final commit is applied to global only the final transaction will be maintained.

    • 0-Based depth of the current transaction. If 0 then it's globally available.

      Returns number

    • Describes the current transaction.

      Returns string

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

      Returns string

    • Returns the state associated to a record for the current transaction or globally if there are no open transactions.

      Type Parameters

      • STATE = any

      Parameters

      • model: any

        The ITransactional object.

      Returns Readonly<STATE>

    • All states in the current transaction.

      Returns Map<any, any>

    • Returns the view associated with this transaction.

      Returns Record<string, any>

    • Update the state for a record.

      Type Parameters

      • STATE = any

      Parameters

      • model: any
      • state: Readonly<Partial<STATE>> | ((prev: Readonly<STATE>) => Readonly<STATE>)

      Returns STATE