New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

patched-undo-peasy

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

patched-undo-peasy - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

4

package.json
{
"name": "patched-undo-peasy",
"version": "0.1.2",
"version": "0.1.3",
"main": "src/UndoRedoApi.ts",

@@ -44,3 +44,3 @@ "dependencies": {

"author": "lee <lee@underneath.ca>",
"homepage": "https://github.com/mighdoll/patched-undo-peasy",
"homepage": "https://github.com/mighdoll/patched-undo-peasy#readme",
"license": "MIT",

@@ -47,0 +47,0 @@ "keywords": [

@@ -1,1 +0,48 @@

undo/redo support for easy peasy
Undo/Redo support for [easy peasy](https://easy-peasy.now.sh/).
*`patched-undo-peasy` currently depends on a [fork](https://github.com/mighdoll/patched-peasy) of easy peasy. (modifying undo-peasy to depend on stock easy-peasy should be straightforward.)
## Usage
1. Attach `undoRedoMiddleWare` in `createStore`.
```
const store = createStore(appModel, {
middleware: [undoRedo()],
});
```
1. If using typescript, the root application model should extend `WithUndo`.
`WithUndo` will add types for undo actions and undo history to your root model.
```
interface Model extends WithUndo {
count: number;
increment: Action<Model>;
}
```
1. Wrap the root application instance in `undoable`.
`undoable` will add types for undo actions and undo history to your root model.
```
const appModel: Model = undoable({
count: 0,
increment: action((state) => {
state.count++;
}),
});
```
1. Profit
```
const undoAction = useStoreActions((actions) => actions.undoUndo);
```
## Supported Actions
* **`undoUndo`** - restore state to the most recently saved version.
* **`undoRedo`** - restore state to the most recently undone version.
* `undoSave` - save current application state to undo history.
undoSave is generated automatically by the middleware, but in rare cases it's useful to save manually.
* `undoReset` - erases saved undo/redo history and saves the current state.
## Configuration
The `undoRedo()` middleware function accepts an optional configuration object.
* `noSaveActions` - a function that tells undoRedo to not save certain actions to undo/redo history.
* `noSaveKeys` - a function tthat tells undoRedo not to save certain keys inside the state model
to undo/redo history. e.g. view state in the model.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc