svghmi/widgets_common.ysl2
branchsvghmi
changeset 3142 2637bb6a6bb0
parent 3139 1f5ca646ce6e
child 3152 c80a5a7198ea
equal deleted inserted replaced
3141:6d4c1e6560ac 3142:2637bb6a6bb0
    63     |   })`if "position()!=last()" > ,`
    63     |   })`if "position()!=last()" > ,`
    64 }
    64 }
    65 
    65 
    66 emit "preamble:local-variable-indexes" {
    66 emit "preamble:local-variable-indexes" {
    67     ||
    67     ||
       
    68 
    68     let hmi_locals = {};
    69     let hmi_locals = {};
    69     var last_remote_index = hmitree_types.length - 1;
    70     var last_remote_index = hmitree_types.length - 1;
    70     var next_available_index = hmitree_types.length;
    71     var next_available_index = hmitree_types.length;
    71     let cookies = new Map(document.cookie.split("; ").map(s=>s.split("=")));
    72     let cookies = new Map(document.cookie.split("; ").map(s=>s.split("=")));
    72 
    73 
    93     }
    94     }
    94     ||
    95     ||
    95     ]);
    96     ]);
    96     var persistent_indexes = new Map();
    97     var persistent_indexes = new Map();
    97     var cache = hmitree_types.map(_ignored => undefined);
    98     var cache = hmitree_types.map(_ignored => undefined);
       
    99     var updates = {};
    98 
   100 
    99     function page_local_index(varname, pagename){
   101     function page_local_index(varname, pagename){
   100         let pagevars = hmi_locals[pagename];
   102         let pagevars = hmi_locals[pagename];
   101         let new_index;
   103         let new_index;
   102         if(pagevars == undefined){
   104         if(pagevars == undefined){
   153         unsub(){
   155         unsub(){
   154             /* remove subsribers */
   156             /* remove subsribers */
   155             if(!this.unsubscribable)
   157             if(!this.unsubscribable)
   156                 for(let i = 0; i < this.indexes.length; i++) {
   158                 for(let i = 0; i < this.indexes.length; i++) {
   157                     /* flush updates pending because of inhibition */
   159                     /* flush updates pending because of inhibition */
   158                     let inhibition = this.inhibit[index];
   160                     let inhibition = this.inhibit[i];
   159                     if(inhibition != undefined){
   161                     if(inhibition != undefined){
   160                         clearTimeout(inhibition);
   162                         clearTimeout(inhibition);
   161                         this.lastapply[index] = undefined;
   163                         this.lastapply[i] = undefined;
   162                         this.unhinibit(index);
   164                         this.unhinibit(i);
   163                     }
   165                     }
   164                     let index = this.indexes[i];
   166                     let index = this.indexes[i];
   165                     if(this.relativeness[i])
   167                     if(this.relativeness[i])
   166                         index += this.offset;
   168                         index += this.offset;
   167                     subscribers(index).delete(this);
   169                     subscribers(index).delete(this);