--- a/svghmi/svghmi.js Thu Oct 24 11:20:04 2019 +0200
+++ b/svghmi/svghmi.js Sun Oct 27 21:38:10 2019 +0100
@@ -5,6 +5,9 @@
function dispatch_value(index, value) {
let widgets = subscribers[index];
+ let oldval = cache[index];
+ cache[index] = value;
+
if(widgets.size > 0) {
for(let widget of widgets){
let idxidx = widget.indexes.indexOf(index);
@@ -13,18 +16,15 @@
}
let d = widget.dispatch;
if(typeof(d) == "function" && idxidx == 0){
- return d.call(widget,value);
+ return d.call(widget, value, oldval);
}else if(typeof(d) == "object" && d.length >= idxidx){
- d[idxidx].call(widget,value);
+ return d[idxidx].call(widget, value, oldval);
}/* else dispatch_0, ..., dispatch_n ? */
/*else {
throw new Error("Dunno how to dispatch to widget at index = " + index);
}*/
}
}
-
- cache[index] = value;
-
};
function init_widgets() {