@node-projects/web-component-designer-visualization-addons 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -55,8 +55,7 @@ export class IndirectSignal {
|
|
|
55
55
|
this.values = new Array(this.signals.length);
|
|
56
56
|
for (let i = 0; i < this.signals.length; i++) {
|
|
57
57
|
let cb = (id, value) => this.handleValueChanged(value.val, i);
|
|
58
|
-
this.unsubscribeList.push(cb);
|
|
59
|
-
this.visualizationHandler.subscribeState(this.signals[i], cb);
|
|
58
|
+
this.unsubscribeList.push([cb, this.visualizationHandler.subscribeState(this.signals[i], cb)]);
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
parseIndirectBinding(id) {
|
|
@@ -75,24 +74,23 @@ export class IndirectSignal {
|
|
|
75
74
|
}
|
|
76
75
|
if (this.combinedName != nm) {
|
|
77
76
|
if (this.unsubscribeTargetValue) {
|
|
78
|
-
this.visualizationHandler.unsubscribeState(this.combinedName, this.unsubscribeTargetValue);
|
|
77
|
+
this.visualizationHandler.unsubscribeState(this.combinedName, this.unsubscribeTargetValue[0], this.unsubscribeTargetValue[1]);
|
|
79
78
|
}
|
|
80
79
|
if (!this.disposed) {
|
|
81
80
|
this.combinedName = nm;
|
|
82
81
|
let cb = (id, value) => this.valueChangedCb(value);
|
|
83
|
-
this.unsubscribeTargetValue = cb;
|
|
84
|
-
this.visualizationHandler.subscribeState(nm, cb);
|
|
82
|
+
this.unsubscribeTargetValue = [cb, this.visualizationHandler.subscribeState(nm, cb)];
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
86
|
dispose() {
|
|
89
87
|
this.disposed = true;
|
|
90
88
|
if (this.unsubscribeTargetValue) {
|
|
91
|
-
this.visualizationHandler.unsubscribeState(this.combinedName, this.unsubscribeTargetValue);
|
|
89
|
+
this.visualizationHandler.unsubscribeState(this.combinedName, this.unsubscribeTargetValue[0], this.unsubscribeTargetValue[1]);
|
|
92
90
|
this.unsubscribeTargetValue = null;
|
|
93
91
|
}
|
|
94
92
|
for (let i = 0; i < this.signals.length; i++) {
|
|
95
|
-
this.visualizationHandler.unsubscribeState(this.signals[i], this.unsubscribeList[i]);
|
|
93
|
+
this.visualizationHandler.unsubscribeState(this.signals[i], this.unsubscribeList[i][0], this.unsubscribeList[i][1]);
|
|
96
94
|
}
|
|
97
95
|
}
|
|
98
96
|
setState(value) {
|
|
@@ -397,7 +395,7 @@ export class BindingsHelper {
|
|
|
397
395
|
let cleanupCalls;
|
|
398
396
|
const cleanUp = () => {
|
|
399
397
|
for (const u of unsubscribeList) {
|
|
400
|
-
this._visualizationHandler.unsubscribeState(u[0], u[1]);
|
|
398
|
+
this._visualizationHandler.unsubscribeState(u[0], u[1], u[2]);
|
|
401
399
|
}
|
|
402
400
|
if (cleanupCalls) {
|
|
403
401
|
for (let e of cleanupCalls) {
|
|
@@ -509,8 +507,7 @@ export class BindingsHelper {
|
|
|
509
507
|
}
|
|
510
508
|
else {
|
|
511
509
|
const cb = (id, value) => this.handleValueChanged(element, binding, value.val, valuesObject, i, signalVars, false);
|
|
512
|
-
unsubscribeList.push([s, cb]);
|
|
513
|
-
this._visualizationHandler.subscribeState(s, cb);
|
|
510
|
+
unsubscribeList.push([s, cb, this._visualizationHandler.subscribeState(s, cb)]);
|
|
514
511
|
this._visualizationHandler.getState(s).then(x => this.handleValueChanged(element, binding, x?.val, valuesObject, i, signalVars, false));
|
|
515
512
|
if (binding[1].twoWay && i == 0) {
|
|
516
513
|
this.addTwoWayBinding(binding, element, v => this._visualizationHandler.setState(s, v));
|
|
@@ -14,8 +14,8 @@ type StateChangeHandler = (id: string, state: State) => void;
|
|
|
14
14
|
export interface VisualizationHandler {
|
|
15
15
|
getState(id: string): Promise<State>;
|
|
16
16
|
setState(id: string, val: State | StateValue, ack?: boolean): Promise<void>;
|
|
17
|
-
subscribeState(id: string, cb: StateChangeHandler):
|
|
18
|
-
unsubscribeState(id: string, cb: StateChangeHandler): void;
|
|
17
|
+
subscribeState(id: string, cb: StateChangeHandler): any;
|
|
18
|
+
unsubscribeState(id: string, cb: StateChangeHandler, info: any): void;
|
|
19
19
|
getObject(id: string): Promise<Signal>;
|
|
20
20
|
getHistoricData(id: string, config: any): any;
|
|
21
21
|
getAllNames(type: string): any;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "web-component-designer addon for visualizations",
|
|
3
3
|
"name": "@node-projects/web-component-designer-visualization-addons",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.12",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|