fun runTransaction(transaction: (DatasyncValuable) -> TransactionOperation, callback: WebcomResultCallback<TransactionResult>? = null): Unit
Performs an atomic write operation (or transaction) on this data node.
The transaction to perform is specified by a function that receives the current value of this data node and returns the operation to run among: aborting the transaction, clearing the data node value or setting the data node value. If the data node value has changed (with respect to the one passed to the function) when the operation is actually attempted on the Webcom back end, then the operation is not run and the function is called with the new data node value, and then the returned operation again attempted on the back end, and so on, until the operation can actually be performed.
Once the operation completed, the callback is called with the transaction result.
Some usual transaction functions are provided within the TransactionOperation.Companion object: TransactionOperation.increment, TransactionOperation.decrement, TransactionOperation.toggle, TransactionOperation.writeIfNone.