]> git.scottworley.com Git - vopamoi/commitdiff
Sort Model methods
authorScott Worley <scottworley@scottworley.com>
Wed, 26 Jan 2022 19:31:02 +0000 (11:31 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 20:21:55 +0000 (12:21 -0800)
vopamoi.ts

index 3042adde1255c00fece833224eb7af7f3521c990..ad1051ad5f9ffc6a4712dc1acada82944e643fac 100644 (file)
@@ -14,6 +14,10 @@ function splitN(str: string, delimiter: string, limit: number = MAX_SAFE_INTEGER
 }
 
 const Model = {
 }
 
 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));
   createTask: function (timestamp: string, description: string) {
     const task = document.createElement("div");
     task.appendChild(document.createTextNode(description));
@@ -23,8 +27,11 @@ const Model = {
     return task;
   },
 
     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) {
   },
 
   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) {
   setState: function (stateTimestamp: string, createTimestamp: string, state: string) {
     const task = this.getTask(createTimestamp);
     if (task) {