1
0
Andrew Chalkley 9 жил өмнө
parent
commit
b6f25fd61f
1 өөрчлөгдсөн 4 нэмэгдсэн , 2 устгасан
  1. 4 2
      front-end/js/app.js

+ 4 - 2
front-end/js/app.js

@@ -6,7 +6,9 @@ const flashButton = $("flash-button");
 const appStatus = $("status");
 const portsSelect = $("ports");
 const serialScanner = new SerialScanner();
-const portToElementMap = {};
+const portToElementMap = {}; // Cache of option elements for the port select
+const pollTime = 1000; // One second
+
 var last_notification = "";
 
 flashButton.addEventListener("click", event => {
@@ -96,7 +98,7 @@ function onError(error){
  */
 function init() {
     serialScanner.scan();
-    setInterval(() =>{ serialScanner.checkForChanges(); }, 1000);
+    setInterval(serialScanner.checkForChanges.bind(serialScanner), pollTime);
 }
 
 init();