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

undoo

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

undoo

Undo/redo manager

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Undoo

Undo/redo manager

Installation

Node.js

npm install undoo --save

Browser

Local
<script src="node_modules/undoo/dist/undoo.min.js"></script>
CDN unpkg
<script src="https://unpkg.com/undoo/dist/undoo.min.js"></script>

Example

const Undoo = require('undoo');

const myHistory = new Undoo();

myHistory.save('one');
myHistory.save('two');
myHistory.save('three');
myHistory.save('four');

myHistory.undo((item)=>{
    console.log(item); //=> three
});

myHistory.current(); //=> three

myHistory.redo((item)=>{
    console.log(item); //=> four
});

Use provider

const Undoo = require('undoo');

const myHistory = new Undoo({
    provider: () => document.getElementById('myTextArea').value
});

myHistory.save();

API

Undoo

Kind: global class

new Undoo([opts])

Create instance

ParamTypeDefaultDescription
[opts]Object

configuration object

[opts.provider]function

optional function called on save that returns new state for history

[opts.maxLength]number20

max length history

undoo.save([item]) ⇒ Undoo

Save history

Kind: instance method of Undoo

ParamType
[item]*

undoo.clear() ⇒ Undoo

Clear history

Kind: instance method of Undoo

undoo.undo(callback) ⇒ Undoo

Undo

Kind: instance method of Undoo

Param
callback

undoo.redo(callback) ⇒ Undoo

Redo

Kind: instance method of Undoo

Param
callback

undoo.current() ⇒ *

Get current item in history

Kind: instance method of Undoo

undoo.count() ⇒ number

Count history items

Kind: instance method of Undoo

undoo.onUpdate(callback)

Triggered when history is updated

Kind: instance method of Undoo

Param
callback

Changelog

You can view the changelog here

License

Undoo is open-sourced software licensed under the MIT license

Author

Fabio Ricali

Keywords

FAQs

Package last updated on 12 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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