# HG changeset patch
# User Edouard Tisserant
# Date 1584002000 -3600
# Node ID 545902730141aa6b1b6cc3d24a5ea5f89bb76c7f
# Parent 36f78f6cfabd2973a5579cd43c78e276a28eba0e
SVGHMI: cosmetic code moving
diff -r 36f78f6cfabd -r 545902730141 svghmi/gen_index_xhtml.xslt
--- a/svghmi/gen_index_xhtml.xslt Tue Mar 10 13:57:29 2020 +0100
+++ b/svghmi/gen_index_xhtml.xslt Thu Mar 12 09:33:20 2020 +0100
@@ -753,31 +753,41 @@
// Apply updates recieved through ws.onmessage to subscribed widgets
- // Do the page swith if any one pending
+ function apply_updates() {
+
+ for(let index in updates){
+
+ // serving as a key, index becomes a string
+
+ // -> pass Number(index) instead
+
+ dispatch_value(Number(index), updates[index]);
+
+ delete updates[index];
+
+ }
+
+ }
+
+
// Called on requestAnimationFrame, modifies DOM
+ var requestAnimationFrameID = null;
+
function animate() {
+ // Do the page swith if any one pending
+
if(current_subscribed_page != current_visible_page){
switch_visible_page(current_subscribed_page);
}
-
-
- for(let index in updates){
-
- // serving as a key, index becomes a string
-
- // -> pass Number(index) instead
-
- dispatch_value(Number(index), updates[index]);
-
- delete updates[index];
-
- }
+ console.log("no page switch");
+
+ apply_updates();
requestAnimationFrameID = null;
@@ -785,8 +795,6 @@
- var requestAnimationFrameID = null;
-
function requestHMIAnimation() {
if(requestAnimationFrameID == null){
diff -r 36f78f6cfabd -r 545902730141 svghmi/svghmi.js
--- a/svghmi/svghmi.js Tue Mar 10 13:57:29 2020 +0100
+++ b/svghmi/svghmi.js Thu Mar 12 09:33:20 2020 +0100
@@ -66,23 +66,27 @@
};
// Apply updates recieved through ws.onmessage to subscribed widgets
-// Do the page swith if any one pending
-// Called on requestAnimationFrame, modifies DOM
-function animate() {
- if(current_subscribed_page != current_visible_page){
- switch_visible_page(current_subscribed_page);
- }
-
+function apply_updates() {
for(let index in updates){
// serving as a key, index becomes a string
// -> pass Number(index) instead
dispatch_value(Number(index), updates[index]);
delete updates[index];
}
+}
+
+// Called on requestAnimationFrame, modifies DOM
+var requestAnimationFrameID = null;
+function animate() {
+ // Do the page swith if any one pending
+ if(current_subscribed_page != current_visible_page){
+ switch_visible_page(current_subscribed_page);
+ }
+ console.log("no page switch");
+ apply_updates();
requestAnimationFrameID = null;
}
-var requestAnimationFrameID = null;
function requestHMIAnimation() {
if(requestAnimationFrameID == null){
requestAnimationFrameID = window.requestAnimationFrame(animate);