equal
deleted
inserted
replaced
71 this.args = args; |
71 this.args = args; |
72 this.indexes = indexes; |
72 this.indexes = indexes; |
73 this.offset = 0; |
73 this.offset = 0; |
74 Object.keys(members).forEach(prop => this[prop]=members[prop]); |
74 Object.keys(members).forEach(prop => this[prop]=members[prop]); |
75 } |
75 } |
|
76 unsub(){ |
|
77 /* remove subsribers */ |
|
78 for(let index of this.indexes){ |
|
79 let idx = index + this.offset; |
|
80 subscribers[idx].delete(this); |
|
81 } |
|
82 this.offset = 0; |
|
83 } |
|
84 |
|
85 sub(new_offset=0){ |
|
86 /* set the offset because relative */ |
|
87 this.offset = new_offset; |
|
88 /* add this's subsribers */ |
|
89 for(let index of this.indexes){ |
|
90 subscribers[index + new_offset].add(this); |
|
91 } |
|
92 need_cache_apply.push(this); |
|
93 } |
|
94 |
|
95 apply_cache() { |
|
96 for(let index of this.indexes){ |
|
97 /* dispatch current cache in newly opened page widgets */ |
|
98 let realindex = index+this.offset; |
|
99 let cached_val = cache[realindex]; |
|
100 if(cached_val != undefined) |
|
101 dispatch_value_to_widget(this, realindex, cached_val, cached_val); |
|
102 } |
|
103 } |
|
104 |
76 } |
105 } |
77 || |
106 || |
78 } |
107 } |
79 |
108 |
80 emit "preamble:hmi-classes" { |
109 emit "preamble:hmi-classes" { |
96 } |
125 } |
97 |
126 |
98 |
127 |
99 // default : normal subscribing |
128 // default : normal subscribing |
100 template "widget", mode="widget_subscribe" { |
129 template "widget", mode="widget_subscribe" { |
101 | sub: subscribe, |
|
102 | unsub: unsubscribe, |
|
103 | apply_cache: widget_apply_cache, |
|
104 } |
130 } |
105 // page aren't subscribers |
131 // page aren't subscribers |
106 template "widget[@type='Page']", mode="widget_subscribe"; |
132 template "widget[@type='Page']", mode="widget_subscribe"; |
107 |
133 |
108 function "defs_by_labels" { |
134 function "defs_by_labels" { |