Created
July 31, 2013 15:51
-
-
Save Paratron/6123243 to your computer and use it in GitHub Desktop.
Easy undo/redo with backbone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.on('change', function(){ | |
changes.push(this.previousAttributes()); | |
}); | |
undo: function(){ | |
undone.push(this.toJSON()); | |
this.set(changes.pop()); | |
} | |
redo: function(){ | |
this.set(undone.pop()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment