Classes
- modifiers
- Modifier methods.
- processors
- Processing methods.
Constructor
new ve.dm.TransactionProcessor(doc, transaction, isStaging)
#
DataModel transaction processor.
This class reads operations from a transaction and applies them one by one. It's not intended
to be used directly; use {ve.dm
.Document#commit} instead.
NOTE: Instances of this class are not recyclable: you can only call .process() on them once.
Parameters:
Name | Type | Description |
---|---|---|
doc |
ve.dm.Document | |
transaction |
ve.dm.Transaction | |
isStaging |
boolean | Transaction is being applied in staging mode |
Methods
advanceCursor(increment)private
#
Advance the main data cursor.
Parameters:
Name | Type | Description |
---|---|---|
increment |
number | Number of positions to increment the cursor by |
applyModifications()private
#
Apply all modifications queued through #queueModification, and add their rollback functions to this.rollbackQueue.
Apply all modifications queued through #queueModification, and add their rollback functions to this.rollbackQueue.
emitQueuedEvents()private
#
Emit all events queued through #queueEvent.
executeOperation(op)private
#
process()private
#
Process all operations.
When all operations are done being processed, the document will be synchronized.
queueEvent(node, name, […args])private
#
Queue an event to be emitted on a node.
Duplicate events will be ignored only if all arguments match exactly (i.e. are reference-equal).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
node |
ve.dm.Node | ||
name |
string | Event name |
|
args |
any |
optional repeatable |
Additional arguments to be passed to the event when fired |
queueModification(modification)private
#
queueUndoFunction(func)
#
Queue an undo function. If an exception is thrown while modifying, #rollbackModifications will invoke these functions in reverse order.
Parameters:
Name | Type | Description |
---|---|---|
func |
function | Undo function to add to the queue |
rollbackModifications()private
#
Roll back all modifications that have been applied so far. This invokes the callbacks returned by the modifier functions.