svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 2980 2a21d6060d64
parent 2979 9442f6a6449e
child 2994 b6a9ef7f7e43
--- a/svghmi/gen_index_xhtml.xslt	Wed Jun 03 13:31:55 2020 +0200
+++ b/svghmi/gen_index_xhtml.xslt	Thu Jun 04 11:14:21 2020 +0200
@@ -912,6 +912,8 @@
 </xsl:text>
     <xsl:text>    frequency = 10; /* FIXME arbitrary default max freq. Obtain from config ? */
 </xsl:text>
+    <xsl:text>    unsubscribable = false;
+</xsl:text>
     <xsl:text>    constructor(elt_id,args,indexes,members){
 </xsl:text>
     <xsl:text>        this.element_id = elt_id;
@@ -932,7 +934,7 @@
 </xsl:text>
     <xsl:text>        /* remove subsribers */
 </xsl:text>
-    <xsl:text>        for(let index of this.indexes){
+    <xsl:text>        if(!this.unsubscribable) for(let index of this.indexes){
 </xsl:text>
     <xsl:text>            let idx = index + this.offset;
 </xsl:text>
@@ -954,7 +956,7 @@
 </xsl:text>
     <xsl:text>        /* add this's subsribers */
 </xsl:text>
-    <xsl:text>        for(let index of this.indexes){
+    <xsl:text>        if(!this.unsubscribable) for(let index of this.indexes){
 </xsl:text>
     <xsl:text>            subscribers[index + new_offset].add(this);
 </xsl:text>
@@ -968,7 +970,7 @@
 </xsl:text>
     <xsl:text>    apply_cache() {
 </xsl:text>
-    <xsl:text>        for(let index of this.indexes){
+    <xsl:text>        if(!this.unsubscribable) for(let index of this.indexes){
 </xsl:text>
     <xsl:text>            /* dispatch current cache in newly opened page widgets */
 </xsl:text>
@@ -2292,11 +2294,7 @@
 </xsl:text>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:text>        this.sub = function(){};
-</xsl:text>
-        <xsl:text>        this.unsub = function(){};
-</xsl:text>
-        <xsl:text>        this.apply_cache = function(){};
+        <xsl:text>        this.unsubscribable = true;
 </xsl:text>
       </xsl:otherwise>
     </xsl:choose>