From ef7ebad4fdeec65f894d080e48fb43d372dec250 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Wed, 26 Jan 2022 13:00:15 -0800 Subject: [PATCH] Eliminate createTask. It's part of addTask In the spirit of maintaining the invariant: all tasks are in the DOM; no loose, floating tasks. --- vopamoi.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vopamoi.ts b/vopamoi.ts index b899c71..ab06155 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -15,16 +15,13 @@ function splitN(str: string, delimiter: string, limit: number = MAX_SAFE_INTEGER const Model = { addTask: function (timestamp: string, description: string) { - document.getElementById("tasks")!.appendChild(this.createTask(timestamp, description)).focus(); - }, - - createTask: function (timestamp: string, description: string) { const task = document.createElement("div"); task.appendChild(document.createTextNode(description)); task.setAttribute("class", "task"); task.setAttribute("tabindex", "0"); task.setAttribute("data-created", timestamp); - return task; + document.getElementById("tasks")!.appendChild(task); + task.focus(); }, destroyTask: function (createTimestamp: string) { -- 2.44.1