]> git.scottworley.com Git - vopamoi/commitdiff
Create tasks
authorScott Worley <scottworley@scottworley.com>
Tue, 25 Jan 2022 10:28:10 +0000 (02:28 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 20:19:10 +0000 (12:19 -0800)
vopamoi.ts

index cb2d50e5555676e16f95ec2d8b94db52bcb9a425..0d2944c0a87cf936f05a0df8403527238a242583 100644 (file)
@@ -1,7 +1,18 @@
-var tasks = [];
+var tasks: string[] = [];
+
+function createViewTask(task: string) {
+  const viewTask = document.createElement("div");
+  viewTask.appendChild(document.createTextNode(task));
+  return viewTask;
+}
+
+function updateView() {
+  tasks.forEach((t) => document.getElementById(t) || document.body.appendChild(createViewTask(t)));
+}
 
 function addTask(task: string) {
   tasks.push(task);
 
 function addTask(task: string) {
   tasks.push(task);
+  updateView();
 }
 
 function browserCreateTask(form: any) {
 }
 
 function browserCreateTask(form: any) {