0.0.4 • Published 5 years ago
@fa-repo/undo-redo v0.0.4
@fa-repo/undo-redo
A javascript package for handling basic undo/redo functionality
Install
npm install --save @fa-repo/undo-redo
Basic usage
import UndoRedo from '@fa-repo/undo-redo';
import arrayMove from 'array-move';
let items = ['apple', 'pear', 'mango'];
const undoRedo = new UndoRedo();
const moveItem = (from, to) => {
undoRedo.add({
do: () => arrayMove(items, from, to),
undo:() => arrayMove(items, to, from),
})
}
const undoChanges = () => {
undoRedo.undo();
}
const redoChanges = () => {
undoRedo.redo();
}
Docs / examples
Discover api and use cases here.
License
mit © @fa-repo