OO-ize DOM builder, improve performance (part 1), add benchmarking suite

This commit is contained in:
impinball 2015-12-15 07:07:50 -05:00
parent c202c04631
commit a7b2294c11
22 changed files with 1953 additions and 813 deletions

View 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 = {}))

View 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 = {}))