Socket
Socket
Sign inDemoInstall

ctrlz

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ctrlz

JSON Edit History Manager for Undo / Redo Functionality


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Install size
44.2 kB
Created
Weekly downloads
 

Changelog

Source

v0.2.0

  • further minimize generated js file with mangling and compression
  • remove livescript header from generated js
  • rename ctrlz.js, ctrlz.min.js to index.js and index.min.js
  • either update module or window, but not both
  • upgrade modules
  • patch test code to make it work with upgraded modules
  • add main and browser field in package.json.
  • release with compact directory structure

Readme

Source

ctrlz

JSON Edit History Manager for Undo / Redo Functionality, powered by operational transform. Keep state and support undo for anything that can be expressed / stored by JSON!

Install

include required js file:

    <script src="path-to-your-ctrlz-bundle.js"></script>

ctrlz uses @plotdb/json0 as a dependency. ctrlz.bundle.min.js already includes it but for a separate file, use ctrlz.mins.js instead, and include @plotdb/json0 separately downloaded from its repo.

Usage

    /* init directly in constructor */
    mananger = new ctrlz({obj: obj});

    /* or alternatively, reset anytime after initialized */
    manager.reset({obj: obj});

    /* when obj is updated */
    manager.update(obj);

    /* if you have ot to apply: */ 
    manager.apply({op: op});

    /* undo, return a undo-ed object */
    ret = manager.undo();

    /* redo, return a redo-ed object */
    ret = manager.redo();

    /* clean history */
    mananger.clear();

License

MIT.

FAQs

Last updated on 22 Jan 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc