An undo/redo library for your app

I wrote about undo before and I pushed it farther. What about an undo/redo system? I extended the v.01 of the undo and I now handle undo and redo in the same object.

Annoucing redo in jskata.undo

I made a new version of jskata.undo still hosted on GitHub. If you look closer, it is now part of a library called jskata that is not officially announced. My next post will talk about it in details.

Demo

Take a look at the demo. The javascript of the demo is available here. You can see the complete doc on GitHub.

How does it work?

Execute an action that you can undo/redo

Doing something requires calling execute with 2 functions as parameters : the do and the undo.

Undo and redo the last action

Very easy!

Events and properties

For the moment, jskata.undo has just one event : onChange.

There are 2 properties : canUndo() and canRedo().

  • I don't want to be a party breaker, but the demo does not work in Chromium (version 5.0.342.9 - WebKit: 533.2, V8: 2.1.2.7).

    "Uncaught SyntaxError: Unexpected token do"
  • Ok, it is now corrected. Tell me if everything is ok.
  • Ho nooooooo... I knew that the new guy in the browser room would be trouble one day. I'm looking at it.
blog comments powered by Disqus