Skip to content
JavaScript Undo Library ⛺
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
README.md
bower.json
index.js
package.json

README.md

Code Shelter

jundo

Undo library for browser and Node.

Install

npm install jundo

Usage

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 a 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', function (evt, actionName, undoCount, redoCount) {
	// actionName: 'register', 'undo', 'redo', 'clear'
});

For more information, check out the specs.

You can’t perform that action at this time.