Skip to content

Javascript package for handling undo/redo functionality.

Notifications You must be signed in to change notification settings

francisashley/undo-redo

Repository files navigation

Undo/Redo

A javascript package for handling undo/redo functionality.

Read the docs

NPM

Install

yarn add @fa-repo/undo-redo --dev

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();
}

License

MIT

About

Javascript package for handling undo/redo functionality.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published