todomvc
Version:
> Helping you select an MV\* framework
21 lines (16 loc) • 366 B
JavaScript
;
var TodoStore = Stapes.create().extend({
'init': function() {
if (!'localStorage' in window) return;
this.emit('ready');
},
'load': function() {
var result = window.localStorage['todos-stapes'];
if (result) {
return JSON.parse(result);
}
},
'save': function(data) {
localStorage['todos-stapes'] = JSON.stringify( data );
}
});