Revert "Revert "More performance improvements + etc.""
This commit is contained in:
parent
897060d6ed
commit
b2faa43f91
28 changed files with 3207 additions and 1326 deletions
14
bench/app/js/models/storage.js
Normal file
14
bench/app/js/models/storage.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(function (app) {
|
||||
"use strict"
|
||||
|
||||
var STORAGE_ID = "todos-mithril"
|
||||
|
||||
app.storage = {
|
||||
get: function () {
|
||||
return JSON.parse(localStorage.getItem(STORAGE_ID) || "[]")
|
||||
},
|
||||
put: function (todos) {
|
||||
localStorage.setItem(STORAGE_ID, JSON.stringify(todos))
|
||||
}
|
||||
}
|
||||
})(this.app || (this.app = {}))
|
||||
12
bench/app/js/models/todo.js
Normal file
12
bench/app/js/models/todo.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/* global m */
|
||||
|
||||
(function (app) {
|
||||
"use strict"
|
||||
|
||||
// Todo Model
|
||||
app.Todo = function (data) {
|
||||
this.title = m.prop(data.title)
|
||||
this.completed = m.prop(data.completed || false)
|
||||
this.editing = m.prop(data.editing || false)
|
||||
}
|
||||
})(this.app || (this.app = {}))
|
||||
Loading…
Add table
Add a link
Reference in a new issue