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