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
Source
Properties
mutations
mutations:
Mutation
[]
Source
recentlyAppendedObj
recentlyAppendedObj:
null
|Obj
Source
store
store:
Store
Source
Methods
appendObj()
appendObj(
obj
):boolean
Atomic mutation to append an obj and returns true if changed
Parameters
• obj: Obj
Returns
boolean
Source
apply()
apply():
void
Apply transaction
Returns
void
Source
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
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
deleteObj()
deleteObj(
obj
):boolean
Atomic mutation to delete an obj and returns true if changed
Parameters
• obj: Obj
Returns
boolean
Source
insertChild()
insertChild(
parent
,obj
,position
?):boolean
Insert a child and returns true if changed
Parameters
• parent: Obj
• obj: Obj
• position?: number
Returns
boolean
Source
push()
push(
mut
):void
Parameters
• mut: Mutation
Returns
void
Source
removeChild()
removeChild(
parent
,obj
):boolean
Remove a child and returns true if changed
Parameters
• parent: Obj
• obj: Obj
Returns
boolean
Source
reorderChild()
reorderChild(
parent
,obj
,position
):boolean
Reorder a child and returns true if changed
Parameters
• parent: Obj
• obj: Obj
• position: number
Returns
boolean
Source
toJSON()
toJSON():
any
Returns
any
Source
unapply()
unapply():
void
Unapply transaction
Returns
void