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