]> git.scottworley.com Git - vopamoi/commitdiff
BrowserUI
authorScott Worley <scottworley@scottworley.com>
Wed, 26 Jan 2022 06:47:55 +0000 (22:47 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 20:21:09 +0000 (12:21 -0800)
index.html
vopamoi.ts

index afb92310049b85518a932ca2895a59acd573135f..2a82c981a64eb33f712fecb9bcfdd50c82981dbf 100644 (file)
@@ -4,7 +4,7 @@
     <script src="vopamoi.js" defer="true"></script>
   </head>
   <body onload="browserInit();">
     <script src="vopamoi.js" defer="true"></script>
   </head>
   <body onload="browserInit();">
-    <form onsubmit="return browserCreateTask(this);">
+    <form onsubmit="return BrowserUI.addTask(this);">
       <input id="taskName" name="taskName">
     </form>
   </body>
       <input id="taskName" name="taskName">
     </form>
   </body>
index bc7acb79604733e42bc570409f62fa6a54fd874d..f127da9102c36e1ceb4b2497a71cd0cbc5b58418 100644 (file)
@@ -80,6 +80,16 @@ const UI = {
   },
 };
 
   },
 };
 
+const BrowserUI = {
+  addTask: function (form: any) {
+    if (form.taskName.value) {
+      UI.addTask(form.taskName.value);
+      form.taskName.value = "";
+    }
+    return false;
+  },
+};
+
 function focusTaskNameInput(event: any) {
   document.getElementById("taskName")!.focus();
   event.preventDefault();
 function focusTaskNameInput(event: any) {
   document.getElementById("taskName")!.focus();
   event.preventDefault();
@@ -93,14 +103,6 @@ function handleKey(event: any) {
   }
 }
 
   }
 }
 
-function browserCreateTask(form: any) {
-  if (form.taskName.value) {
-    UI.addTask(form.taskName.value);
-  }
-  form.taskName.value = "";
-  return false;
-}
-
 function browserInit() {
   document.body.addEventListener("keydown", handleKey, { capture: false });
   Log.replay();
 function browserInit() {
   document.body.addEventListener("keydown", handleKey, { capture: false });
   Log.replay();