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:317

Properties

mutations

mutations: Mutation[]

Source

core/transaction.ts:314


recentlyAppendedObj

recentlyAppendedObj: null | Obj

Source

core/transaction.ts:315


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:356


apply()

apply(): void

Apply transaction

Returns

void

Source

core/transaction.ts:334


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:383


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:406


deleteObj()

deleteObj(obj): boolean

Atomic mutation to delete an obj and returns true if changed

Parameters

obj: Obj

Returns

boolean

Source

core/transaction.ts:370


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:429


push()

push(mut): void

Parameters

mut: Mutation

Returns

void

Source

core/transaction.ts:323


removeChild()

removeChild(parent, obj): boolean

Remove a child and returns true if changed

Parameters

parent: Obj

obj: Obj

Returns

boolean

Source

core/transaction.ts:442


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:455


toJSON()

toJSON(): any

Returns

any

Source

core/transaction.ts:327


unapply()

unapply(): void

Unapply transaction

Returns

void

Source

core/transaction.ts:345