X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/28568279f452686693f5e92182ce83651afbc174..9e79bdbb90ffcb5929f76a4fb6860ed6396ac9de:/vopamoi.ts diff --git a/vopamoi.ts b/vopamoi.ts index 5967c7d..cfa1186 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -1,19 +1,12 @@ -var tasks: string[] = []; - -function createViewTask(task: string) { - const viewTask = document.createElement("div"); - viewTask.appendChild(document.createTextNode(task)); - viewTask.setAttribute("tabindex", "0"); - return viewTask; -} - -function updateView() { - tasks.forEach((t) => document.getElementById(t) || document.body.appendChild(createViewTask(t))); +function createTask(description: string) { + const task = document.createElement("div"); + task.appendChild(document.createTextNode(description)); + task.setAttribute("tabindex", "0"); + return task; } -function addTask(task: string) { - tasks.push(task); - updateView(); +function addTask(description: string) { + document.body.appendChild(createTask(description)); } function browserCreateTask(form: any) {