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