]>
Commit | Line | Data |
---|---|---|
7dcd9167 SW |
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 | } | |
974848d3 SW |
12 | |
13 | function addTask(task: string) { | |
14 | tasks.push(task); | |
7dcd9167 | 15 | updateView(); |
974848d3 SW |
16 | } |
17 | ||
18 | function browserCreateTask(form: any) { | |
19 | addTask(form.taskName.value); | |
20 | form.taskName.value = ""; | |
21 | return false; | |
22 | } |