--- 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,19 +753,7 @@
<xsl:text>// Apply updates recieved through ws.onmessage to subscribed widgets
- <xsl:text>// Do the page swith if any one pending
- <xsl:text>// Called on requestAnimationFrame, modifies DOM
- <xsl:text>function animate() {
- <xsl:text> if(current_subscribed_page != current_visible_page){
- <xsl:text> switch_visible_page(current_subscribed_page);
+ <xsl:text>function apply_updates() { <xsl:text> for(let index in updates){
@@ -779,14 +767,34 @@
+ <xsl:text>// Called on requestAnimationFrame, modifies DOM + <xsl:text>var requestAnimationFrameID = null; + <xsl:text>function animate() { + <xsl:text> // Do the page swith if any one pending + <xsl:text> if(current_subscribed_page != current_visible_page){ + <xsl:text> switch_visible_page(current_subscribed_page); + <xsl:text> console.log("no page switch"); + <xsl:text> apply_updates(); <xsl:text> requestAnimationFrameID = null;
- <xsl:text>var requestAnimationFrameID = null;
<xsl:text>function requestHMIAnimation() {
<xsl:text> if(requestAnimationFrameID == null){
--- 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
- 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]);
+// Called on requestAnimationFrame, modifies DOM +var requestAnimationFrameID = null; + // 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"); requestAnimationFrameID = null;
-var requestAnimationFrameID = null;
function requestHMIAnimation() {
if(requestAnimationFrameID == null){
requestAnimationFrameID = window.requestAnimationFrame(animate);