Class: TransactionManager
The Transaction Manager is responsible for tracking and managing all of the registered transaction operations which represent creator changes in the world. Transaction Manager is the basis of the UNDO and REDO operations, and allows a creator to store the changes made to the world and the state of the world BEFORE those changes were applied, making it possible to UNDO those changes and restore the world state. The transactions are stored as a stack, and can be undone in stack order to restore the world to it's original state
Constructors
new TransactionManager()
private
new TransactionManager():TransactionManager
Returns
Methods
addUserDefinedOperation()
addUserDefinedOperation(
transactionHandlerId
,operationData
,operationName
?):void
Parameters
Parameter | Type |
---|---|
transactionHandlerId | UserDefinedTransactionHandlerId |
operationData | string |
operationName ? | string |
Returns
void
Remarks
This function can't be called in read-only mode.
Throws
This function can throw errors.
commitOpenTransaction()
commitOpenTransaction():
boolean
Returns
boolean
Remarks
Commit all of the transaction operations currently attached to the open transaction record to the manager. These will be added as a single transaction manager entry. The open record will be closed and all tracking operations will cease.
This function can't be called in read-only mode.
Throws
This function can throw errors.
commitTrackedChanges()
commitTrackedChanges():
number
Returns
number
Returns the number of change requests that were being tracked
Remarks
This function will commit the pending changes caused by any of the track changes variants. The changes will be committed to the currently open transaction, but the transaction will remain open for further records. Pending block changes from tracking operations will be added to the transaction record before submission to the transaction manager
This function can't be called in read-only mode.
Throws
This function can throw errors.
createUserDefinedTransactionHandler()
createUserDefinedTransactionHandler(
undoClosure
,redoClosure
):UserDefinedTransactionHandlerId
Parameters
Parameter | Type |
---|---|
undoClosure | (arg ) => void |
redoClosure | (arg ) => void |
Returns
UserDefinedTransactionHandlerId
Remarks
This function can't be called in read-only mode.
Throws
This function can throw errors.