You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
604 B
JavaScript
26 lines
604 B
JavaScript
/*global app, $on */
|
|
(function () {
|
|
'use strict';
|
|
|
|
/**
|
|
* Sets up a brand new Todo list.
|
|
*
|
|
* @param {string} name The name of your new to do list.
|
|
*/
|
|
function Todo(name) {
|
|
this.storage = new app.Store(name);
|
|
this.model = new app.Model(this.storage);
|
|
this.template = new app.Template();
|
|
this.view = new app.View(this.template);
|
|
this.controller = new app.Controller(this.model, this.view);
|
|
}
|
|
|
|
var todo = new Todo('todos-vanillajs');
|
|
|
|
function setView() {
|
|
todo.controller.setView(document.location.hash);
|
|
}
|
|
$on(window, 'load', setView);
|
|
$on(window, 'hashchange', setView);
|
|
})();
|