--- a/svghmi/gen_index_xhtml.xslt Thu Aug 13 11:30:18 2020 +0200
+++ b/svghmi/gen_index_xhtml.xslt Thu Aug 13 11:37:39 2020 +0200
@@ -1141,10 +1141,6 @@
<xsl:text> apply_cache() {
- <xsl:text> let dispatch = this.dispatch;
- <xsl:text> if(dispatch == undefined) return;
<xsl:text> if(!this.unsubscribable) for(let index in this.indexes){
<xsl:text> /* dispatch current cache in newly opened page widgets */
@@ -1155,15 +1151,7 @@
<xsl:text> if(cached_val != undefined)
- <xsl:text> dispatch.call(this, cached_val, cached_val, index);
- <xsl:text> } catch(err) {
- <xsl:text> console.log(err);
+ <xsl:text> this._dispatch(cached_val, cached_val, index); @@ -1213,10 +1201,6 @@
<xsl:text> // TODO avoid searching, store index at sub()
- <xsl:text> let dispatch = this.dispatch;
- <xsl:text> if(dispatch == undefined) return;
<xsl:text> for(let i = 0; i < this.indexes.length; i++) {
<xsl:text> let refindex = this.get_variable_index(i);
@@ -1225,15 +1209,7 @@
<xsl:text> if(index == refindex) {
- <xsl:text> dispatch.call(this, value, oldval, i);
- <xsl:text> } catch(err) {
- <xsl:text> console.log(err);
+ <xsl:text> this._dispatch(value, oldval, i); @@ -1245,6 +1221,28 @@
+ <xsl:text> _dispatch(value, oldval, varnum) { + <xsl:text> let dispatch = this.dispatch; + <xsl:text> if(dispatch != undefined){ + <xsl:text> dispatch.call(this, value, oldval, varnum); + <xsl:text> } catch(err) { + <xsl:text> console.log(err); <xsl:text> this.animate();
--- a/svghmi/widgets_common.ysl2 Thu Aug 13 11:30:18 2020 +0200
+++ b/svghmi/widgets_common.ysl2 Thu Aug 13 11:37:39 2020 +0200
@@ -158,18 +158,12 @@
- let dispatch = this.dispatch;
- if(dispatch == undefined) return;
if(!this.unsubscribable) for(let index in this.indexes){
/* dispatch current cache in newly opened page widgets */
let realindex = this.get_variable_index(index);
let cached_val = cache[realindex];
if(cached_val != undefined)
- dispatch.call(this, cached_val, cached_val, index);
+ this._dispatch(cached_val, cached_val, index); @@ -194,22 +188,27 @@
new_hmi_value(index, value, oldval) {
// TODO avoid searching, store index at sub()
- let dispatch = this.dispatch;
- if(dispatch == undefined) return;
for(let i = 0; i < this.indexes.length; i++) {
let refindex = this.get_variable_index(i);
- dispatch.call(this, value, oldval, i);
+ this._dispatch(value, oldval, i); + _dispatch(value, oldval, varnum) { + let dispatch = this.dispatch; + if(dispatch != undefined){ + dispatch.call(this, value, oldval, varnum); this.pending_animate = false;