import { useTransactions } from '@threlte/studio/extensions'
const transactions = useTransactions()
// convenience method for building a transaction
const transaction = transactions.buildTransaction({
propertyPath: 'material.color',
createHistoryRecord: true,
// commit a set of changes to the transaction queue
write: (object, value) => {
object.position.set(value[0], value[1], value[2])
return root.position.toArray()
createHistoryRecord: true
// undo the last transaction
// redo the last transaction
transactions.onTransaction(() => {
// called when a transaction is committed, undone, or redone
console.log('transaction')
transactions.onCommit(() => {
// called when a transaction is committed
transactions.onUndo(() => {
// called when a transaction is undone
transactions.onRedo(() => {
// called when a transaction is redone
// Clean up subscriptions
const unsubscribe = transactions.onTransaction(() => {
// open the editor for the given object
transactions.openInEditor(mesh)
// open the editor for the selected object
transactions.openSelectedInEditor()
// check if the Vite plugin is enabled
transactions.vitePluginEnabled // true