For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /server-editor/classes/TransactionManager.md.

Class: TransactionManager

Beta

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

Methods

createPendingTransaction()

createPendingTransaction(name): PendingTransaction

World Mutation Beta

Parameters

name

string

Returns

PendingTransaction

Remarks

Throws

This function can throw errors.


redo()

redo(): void

World Mutation Beta

Returns

void

Remarks

Perform an redo operation. This will take the last transaction record on the redo stack and store the current world state and then apply the changes in the record. This will reduce the redo record stack by one.

The transaction record affected by this operation will be transferred to the undo stack in case the creator decides to undo it

Throws

This function can throw errors.


redoSize()

redoSize(): number

World Mutation Beta

Returns

number

Remarks

Return the number of transaction records on the redo stack.

Throws

This function can throw errors.


registerTransactionHandler()

registerTransactionHandler(onEvent?): TransactionHandler

World Mutation Beta

Parameters

onEvent?

(arg0) => void

Returns

TransactionHandler

Remarks

Throws

This function can throw errors.


undo()

undo(): void

World Mutation Beta

Returns

void

Remarks

Perform an undo operation. This will take the last transaction record on the stack and apply the stored world state from before the changes were made. This will reduce the record stack by one.

The transaction record affected by this operation will be transferred to the redo stack in case the creator decides to reapply it

Throws

This function can throw errors.


undoSize()

undoSize(): number

World Mutation Beta

Returns

number

Remarks

Return how many transactions records currently exist on the stack

Throws

This function can throw errors.