Backbone.Undo.js not working as desired. In fact not working at all

I am trying to implement Backbone.js Undo manager with my existing code. My application is kind of template builder.

Here is console.log of main object.

As you can see it has palette and editor object. I want to register undo, redo with that. Here is my code for undo manager intergation.

var UndoManager = new Backbone.UndoManager;
    UndoManager.register(app.editor,app.palette,DdBuilder); // Pass any number of arguments
    UndoManager.startTracking(); // Start observation after instantiation
    $(".fusion_undo").click(function () {

        alert(UndoManager.isAvailable("undo")); //returns false always
    $(".fusion_redo").click(function () {

I believe it is simple integration and I am missing some minor details. Any idea what it could be?


Do app.editor, app.palette and DbBuilder trigger Backbone-events? The UndoManager adds listeners to the objects that are passed to the register-function. If you haven't extended the supported UndoTypes your UndoManager supports the add, remove, reset and change events and creates undoable actions from these events.

You may want to test whether your objects trigger these events by logging them into the console.

app.editor.on("all", console.log, console);
app.palette.on("all", console.log, console);
DbBuilder.on("all", console.log, console);

If they trigger one of the events and isAvailable("undo") still returns false afterwards then there must be a tougher problem, but try this at first.

Need Your Help

How to utilize my computation resources

c# performance multithreading utilization

I wrote a program to solve a complicated problem. This program is just a c# console application and doesn't do console.write until the computation part is finished, so output won't affect the perfo...