]> git.scottworley.com Git - vopamoi/blob - vopamoi.ts
0d2944c0a87cf936f05a0df8403527238a242583
[vopamoi] / vopamoi.ts
1 var tasks: string[] = [];
2
3 function createViewTask(task: string) {
4 const viewTask = document.createElement("div");
5 viewTask.appendChild(document.createTextNode(task));
6 return viewTask;
7 }
8
9 function updateView() {
10 tasks.forEach((t) => document.getElementById(t) || document.body.appendChild(createViewTask(t)));
11 }
12
13 function addTask(task: string) {
14 tasks.push(task);
15 updateView();
16 }
17
18 function browserCreateTask(form: any) {
19 addTask(form.taskName.value);
20 form.taskName.value = "";
21 return false;
22 }