+ this.undoStack.push(transaction);
+ this.trigger('operationEnd');
+
+ }
+ },
+
+ startTransaction: function(metadata) {
+ if(this._currentTransaction) {
+ throw new Error('Nested transactions not supported!');
+ }
+ this._rollbackBackup = this.root.clone();
+ this._currentTransaction = new Transaction([], metadata);
+ },
+
+ endTransaction: function() {
+ if(!this._currentTransaction) {
+ throw new Error('End of transaction requested, but there is no transaction in progress!');
+ }
+ if(this._currentTransaction.hasTransformations()) {
+ this.undoStack.push(this._currentTransaction);
+ this.trigger('operationEnd');
+ }
+ this._currentTransaction = null;
+ },