Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Undo-Buffer

const undoBuffer = new UndoBuffer({
    objectHash: function(d, i) {
        // Allow matching for arrays of objects by object key rather than array index.
        if (d && Object.prototype.hasOwnProperty.call(d, '_id')) {
            return d._id;
        } else if (d && Object.prototype.hasOwnProperty.call(d, 'id')) {
            return d.id;
        } else {
            return '$$index:' + i;
        }
    },
});

undoBuffer.update({ a: 'baz' }, { a: 'foo', b: 'bar' });
undoBuffer.undo(observe);
undoBuffer.undo(observe);
undoBuffer.redo(observe);

API

About

Generic undo tracking system

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages