Components with support for transactionality implement this interface.

interface Participant {
    postCommit?: (() => MaybePromise);
    preCommit?: (() => MaybePromise<boolean>);
    role?: {};
    commit1(): MaybePromise;
    commit2(): MaybePromise;
    rollback(): MaybePromise;
    toString(): string;
}

Properties

postCommit?: (() => MaybePromise)

Post-commit logic.

preCommit?: (() => MaybePromise<boolean>)

Pre-commit logic.

Pre-commit logic returns a boolean indicating whether it performed an action that affects state. The transaction will cycle through participants continuously until all participants return false.

Thus preCommit implementations must be stateful and expect to be invoked more than once for a single transaction.

role?: {}

The "role" of a participant is an optional key you may use to retrieve a participant from the transaction.

Methods