svghmi/svghmi.js
branchwxPython4
changeset 3609 51a3d6f39944
parent 3603 f1a00aa8cb3b
child 3624 770c613c424f
--- a/svghmi/svghmi.js	Tue Sep 13 16:51:54 2022 +0200
+++ b/svghmi/svghmi.js	Tue Sep 13 16:53:15 2022 +0200
@@ -1,7 +1,5 @@
 // svghmi.js
 
-var need_cache_apply = [];
-
 function dispatch_value(index, value) {
     let widgets = subscribers(index);
 
@@ -86,13 +84,8 @@
             }
         }
 
-        while(widget = need_cache_apply.pop()){
-            widget.apply_cache();
-        }
-
         if(jumps_need_update) update_jumps();
 
-        apply_updates();
 
         pending_widget_animates.forEach(widget => widget._animate());
         pending_widget_animates = [];
@@ -139,8 +132,9 @@
                 throw new Error("Unknown index "+index);
             }
         };
+
+        apply_updates();
         // register for rendering on next frame, since there are updates
-        requestHMIAnimation();
     } catch(err) {
         // 1003 is for "Unsupported Data"
         // ws.close(1003, err.message);
@@ -348,14 +342,13 @@
 
 function send_hmi_value(index, value) {
     if(index > last_remote_index){
-        updates.set(index, value);
+        dispatch_value(index, value);
 
         if(persistent_indexes.has(index)){
             let varname = persistent_indexes.get(index);
             document.cookie = varname+"="+value+"; max-age=3153600000";
         }
 
-        requestHMIAnimation();
         return;
     }