From: Scott Worley Date: Tue, 25 Jan 2022 10:28:10 +0000 (-0800) Subject: Create tasks X-Git-Url: http://git.scottworley.com/vopamoi/commitdiff_plain/7dcd916735fa4df2d8c27ccef144be0081bbe737?hp=974848d36d6c4f1b171bd990f3d5659cb0e8134d Create tasks --- diff --git a/vopamoi.ts b/vopamoi.ts index cb2d50e..0d2944c 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -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); + updateView(); } function browserCreateTask(form: any) {