'use strict';
/**
* Génère l'application
* @constructor
*/
function App(){
/**
* Définit une nouvelle TodoList
* @constructor
* @param {string} (name) Nom de la ToDoList (default : "todos-vanillajs")
*/
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);
}
/**
* Créé une nouvelle ToDoList
*/
var todo = new Todo('todos-vanillajs');
/**
* Définit la vue au chargement ou au changement de hash
*/
function setView() {
todo.controller.setView(document.location.hash);
}
$on(window, 'load', setView);
$on(window, 'hashchange', setView);
}