Home

Persistence and undo.

undo.js
Name: <input id="name" onblur="persistence.change()"></input><br> Age: <input id="age" onblur="persistence.change()"></input><br> <button onclick="persistence.save()">Save</button> <button onclick="persistence.undo()">Undo</button> <button onclick="persistence.redo()">Redo</button>
let persistence = new Persistence({ getModel: function() { persistenceId: 'examples.Persistence', return { name: document.getElementById( 'name' ).value, age: document.getElementById( 'age' ).value } }, setModel: function( model ) { document.getElementById( 'name' ).value = model.name; document.getElementById( 'age' ).value = model.age; } });
Name:
Age: