]> git.scottworley.com Git - vopamoi/blobdiff - vopamoi.ts
No MVMVC; DOM *is* the model.
[vopamoi] / vopamoi.ts
index 5967c7d909136eab3975fa042304f96d413105fe..cfa118695c4f82c00b113e605b522710eac07489 100644 (file)
@@ -1,19 +1,12 @@
-var tasks: string[] = [];
-
-function createViewTask(task: string) {
-  const viewTask = document.createElement("div");
-  viewTask.appendChild(document.createTextNode(task));
-  viewTask.setAttribute("tabindex", "0");
-  return viewTask;
-}
-
-function updateView() {
-  tasks.forEach((t) => document.getElementById(t) || document.body.appendChild(createViewTask(t)));
+function createTask(description: string) {
+  const task = document.createElement("div");
+  task.appendChild(document.createTextNode(description));
+  task.setAttribute("tabindex", "0");
+  return task;
 }
 
-function addTask(task: string) {
-  tasks.push(task);
-  updateView();
+function addTask(description: string) {
+  document.body.appendChild(createTask(description));
 }
 
 function browserCreateTask(form: any) {