Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

About

JavaScript Undo Library

Resources

Sponsor this project

 

Packages

No packages published