mirror of https://github.com/vuejs/vue.git
13 lines
383 B
JavaScript
13 lines
383 B
JavaScript
var todoStorage = (function () {
|
|
var STORAGE_KEY = 'todos-seedjs',
|
|
todos = null
|
|
return {
|
|
fetch: function () {
|
|
if (!todos) todos = JSON.parse(localStorage.getItem(this.STORAGE_KEY) || '[]')
|
|
return todos
|
|
},
|
|
save: function () {
|
|
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(todos))
|
|
}
|
|
}
|
|
}()) |