Skip to content

Transaction

Transation is an operation consists of a set of mutations

Note:

  • all mutations are immediately applied when it created (this is because constraints are resolved based on current obj states)
  • apply() and unapply() are called when only undo and redo

Constructors

new Transaction()

new Transaction(store): Transaction

Parameters

store: Store

Returns

Transaction

Source

core/transaction.ts:316

Properties

mutations

mutations: Mutation[]

Source

core/transaction.ts:314


store

store: Store

Source

core/transaction.ts:313

Methods

appendObj()

appendObj(obj): boolean

Atomic mutation to append an obj and returns true if changed

Parameters

obj: Obj

Returns

boolean

Source

core/transaction.ts:354


apply()

apply(): void

Apply transaction

Returns

void

Source

core/transaction.ts:332


assign()

assign(obj, field, value): boolean

Assign a value to shape’s field and returns true if changed

Parameters

obj: Obj

field: string

value: any

Returns

boolean

Source

core/transaction.ts:380


assignRef()

assignRef(obj, field, value): boolean

Assign a ref to shape’s field and returns true if changed

Parameters

obj: Obj

field: string

value: null | Obj

Returns

boolean

Source

core/transaction.ts:403


deleteObj()

deleteObj(obj): boolean

Atomic mutation to delete an obj and returns true if changed

Parameters

obj: Obj

Returns

boolean

Source

core/transaction.ts:367


insertChild()

insertChild(parent, obj, position?): boolean

Insert a child and returns true if changed

Parameters

parent: Obj

obj: Obj

position?: number

Returns

boolean

Source

core/transaction.ts:426


push()

push(mut): void

Parameters

mut: Mutation

Returns

void

Source

core/transaction.ts:321


removeChild()

removeChild(parent, obj): boolean

Remove a child and returns true if changed

Parameters

parent: Obj

obj: Obj

Returns

boolean

Source

core/transaction.ts:439


reorderChild()

reorderChild(parent, obj, position): boolean

Reorder a child and returns true if changed

Parameters

parent: Obj

obj: Obj

position: number

Returns

boolean

Source

core/transaction.ts:452


toJSON()

toJSON(): any

Returns

any

Source

core/transaction.ts:325


unapply()

unapply(): void

Unapply transaction

Returns

void

Source

core/transaction.ts:343