Skip to content

Commit

Permalink
Remove handling of faulty hist in history service
Browse files Browse the repository at this point in the history
  • Loading branch information
LFDM committed May 5, 2014
1 parent afdbc73 commit 48dc5e8
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions app/js/services/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,13 @@ angular.module('arethusa').service('history', function(configurator) {
/* global HistoryObj */
var hist = new HistoryObj(this.maxSize);

/* If the history is triggered by a watch, undo/redo will immediately
* fire another event once it's done - it's just another change after
* all. That's not helpful for our cause though, we therefore skip one
* digest cycle and make changes without propagating the second change
* to history. The event still fires - others might want to listen. */
var skipCycle = false;

this.history = hist.elements;

this.save = function(event) {
if (skipCycle) {
skipCycle = false;
} else {
hist.save(event);
}
hist.save(event);
};

this.undo = function() {
skipCycle = true;
hist.undo();
};

Expand All @@ -35,7 +23,6 @@ angular.module('arethusa').service('history', function(configurator) {
};

this.redo = function() {
skipCycle = true;
hist.redo();
};

Expand Down

0 comments on commit 48dc5e8

Please sign in to comment.