--- a/svghmi/svghmi.js Sun May 10 16:32:19 2020 +0200
+++ b/svghmi/svghmi.js Sun May 10 16:34:44 2020 +0200
@@ -325,40 +325,6 @@
- /* remove subsribers */
- for(let index of this.indexes){
- let idx = index + this.offset;
- subscribers[idx].delete(this);
-function subscribe(new_offset=0){
- /* set the offset because relative */
- this.offset = new_offset;
- /* add this's subsribers */
- for(let index of this.indexes){
- subscribers[index + new_offset].add(this);
- need_cache_apply.push(this);
-function widget_apply_cache() {
- for(let index of this.indexes){
- /* dispatch current cache in newly opened page widgets */
- let realindex = index+this.offset;
- let cached_val = cache[realindex];
- if(cached_val != undefined)
- dispatch_value_to_widget(this, realindex, cached_val, cached_val);
function switch_visible_page(page_name) {
let old_desc = page_desc[current_visible_page];
--- a/svghmi/widgets_common.ysl2 Sun May 10 16:32:19 2020 +0200
+++ b/svghmi/widgets_common.ysl2 Sun May 10 16:34:44 2020 +0200
@@ -73,6 +73,35 @@
Object.keys(members).forEach(prop => this[prop]=members[prop]);
+ /* remove subsribers */ + for(let index of this.indexes){ + let idx = index + this.offset; + subscribers[idx].delete(this); + /* set the offset because relative */ + this.offset = new_offset; + /* add this's subsribers */ + for(let index of this.indexes){ + subscribers[index + new_offset].add(this); + need_cache_apply.push(this); + for(let index of this.indexes){ + /* dispatch current cache in newly opened page widgets */ + let realindex = index+this.offset; + let cached_val = cache[realindex]; + if(cached_val != undefined) + dispatch_value_to_widget(this, realindex, cached_val, cached_val); @@ -98,9 +127,6 @@
// default : normal subscribing
template "widget", mode="widget_subscribe" {
- | apply_cache: widget_apply_cache,
// page aren't subscribers
template "widget[@type='Page']", mode="widget_subscribe";