Home > @theatre/studio > IStudio > transaction
# IStudio.transaction() method
Runs an undo-able transaction. Creates a single undo level for all the operations inside the transaction.
Will roll back if an error is thrown.
Signature:
transaction(fn: (api: ITransactionAPI) => void): void;
# Parameters
Parameter | Type | Description |
---|---|---|
fn | (api: ITransactionAPI) => void |
Returns:
void
# Example
Usage:
studio.transaction(({set, unset}) => {
set(obj.props.x, 10) // set the value of obj.props.x to 10
unset(obj.props.y) // unset the override at obj.props.y
})