-
-
Notifications
You must be signed in to change notification settings - Fork 117
History
Christian Alfoni edited this page Mar 5, 2015
·
4 revisions
var Baobab = require('baobab');
var tree = new Baobab({
todos: []
}, {
maxHistory: 1 // Default: 0
});
tree.hasHistory(); // false
tree.on('update', function () {
tree.hasHistory(); // true
tree.getHistory(); // { data: { todos: [] }, log: [['todos']] }
tree.get(); // { todos: ['foo'] }
tree.undo();
tree.get(); // { todos: [] }
});
tree.select('todos').push('foo');