0.1.0 • Published 12 years ago
jundo v0.1.0
jundo
Undo library for browser and Node.
Install
npm install jundoUsage
var jundo = new JUndo();
...To mark an action which can be undone:
jundo.register(undoFunc, redoFunc);undoFunc is the function that will be invoked upon undoing, redoFunc upon redoing. For example, if an action that adds an object to the screen has been performed, the undo function should remove that object while the redo function should add that object back to the screen.
To undo and redo:
if (jundo.undoCount() > 0) jundo.undo();
if (jundo.redoCount() > 0) jundo.redo();To clear all registered functions:
jundo.clear();Events:
jundo.on('change', func(evt, actionName, undoCount, redoCount) {
// actionName: 'register', 'undo', 'redo', 'clear'
});For more information, check out the specs.
0.1.0
12 years ago