From 412e36630caf4f0133959e1641d8a85ba8f5fcc6 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Wed, 26 Jan 2022 11:31:02 -0800 Subject: [PATCH] Sort Model methods --- vopamoi.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/vopamoi.ts b/vopamoi.ts index 3042add..ad1051a 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -14,6 +14,10 @@ function splitN(str: string, delimiter: string, limit: number = MAX_SAFE_INTEGER } const Model = { + addTask: function (timestamp: string, description: string) { + document.body.appendChild(this.createTask(timestamp, description)).focus(); + }, + createTask: function (timestamp: string, description: string) { const task = document.createElement("div"); task.appendChild(document.createTextNode(description)); @@ -23,8 +27,11 @@ const Model = { return task; }, - addTask: function (timestamp: string, description: string) { - document.body.appendChild(this.createTask(timestamp, description)).focus(); + destroyTask: function (createTimestamp: string) { + const task = this.getTask(createTimestamp); + if (task) { + task.parentElement!.removeChild(task); + } }, getTask: function (createTimestamp: string) { @@ -35,13 +42,6 @@ const Model = { } }, - destroyTask: function (createTimestamp: string) { - const task = this.getTask(createTimestamp); - if (task) { - task.parentElement!.removeChild(task); - } - }, - setState: function (stateTimestamp: string, createTimestamp: string, state: string) { const task = this.getTask(createTimestamp); if (task) { -- 2.44.1