mediawiki-extensions-Visual.../modules/es/models/es.HistoryStateModel.js
Trevor Parscal 631323b9bd * Refactored es.HistoryModel to always be working from a single array rather than a buffer and an array
* Added support for associating a selection with a state
2011-11-21 23:51:37 +00:00

32 lines
673 B
JavaScript

/**
* Creates an es.HistoryStateModel object.
*
* @class
* @constructor
*/
es.HistoryStateModel = function() {
this.transactions = [];
this.selection = null;
};
/* Methods */
es.HistoryStateModel.prototype.getSelection = function() {
return this.selection;
};
es.HistoryStateModel.prototype.getTransactions = function() {
return this.transactions;
};
es.HistoryStateModel.prototype.getTransactionCount = function() {
return this.transactions.length;
};
es.HistoryStateModel.prototype.pushTransaction = function( transaction, selection ) {
this.transactions.push( transaction );
if ( selection !== undefined ) {
this.selection = selection.clone();
}
};