vue2/examples/todomvc/js/todoStorage.js

11 lines
328 B
JavaScript
Raw Normal View History

var todoStorage = (function () {
var STORAGE_KEY = 'todos-seedjs'
return {
fetch: function () {
return JSON.parse(localStorage.getItem(this.STORAGE_KEY) || '[]')
},
save: function (todos) {
2013-08-20 01:09:06 +08:00
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(todos))
}
}
}())