Interface TransactionService<T, S>

Type parameters

Hierarchy

Implemented by

Index

Properties

canRedo

canRedo: boolean
@returns

if there are any transactions in the Redo stack

canUndo

canUndo: boolean
@returns

if there are any transactions in the Undo stack

Readonly enabled

enabled: boolean

Returns whether transaction is enabled for this service

Optional onStateUpdate

onStateUpdate: EventEmitter<StateUpdateEvent>

Event fired when transaction state has changed - add transaction, commit all transactions, undo and redo

Methods

add

  • add(transaction: T, recordRef?: any): void

clear

  • clear(id?: any): void

commit

  • commit(data: any[], id?: any): void

endPending

  • endPending(commit: boolean): void

getAggregatedChanges

  • getAggregatedChanges(mergeChanges: boolean): T[]
  • Returns aggregated changes from all transactions

    Parameters

    • mergeChanges: boolean

      If set to true will merge each state's value over relate recordRef and will record resulting value in the related transaction

    Returns T[]

    Collection of aggregated transactions for each changed record

getAggregatedValue

  • getAggregatedValue(id: any, mergeChanges: boolean): any
  • Returns value of the required id including all uncommitted changes

    Parameters

    • id: any

      The id of the record to return value for

    • mergeChanges: boolean

      If set to true will merge state's value over relate recordRef and will return merged value

    Returns any

    Value with changes or null

getState

  • getState(id: any, pending?: boolean): S

getTransactionLog

  • getTransactionLog(id?: any): T[]

redo

  • redo(): void

startPending

  • startPending(): void

undo

  • undo(): void