@dra2020/baseclient 1.0.76 → 1.0.77
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.
- package/dist/baseclient.js +18 -7
- package/dist/baseclient.js.map +1 -1
- package/dist/dataflow/dataflow.d.ts +14 -5
- package/lib/dataflow/dataflow.ts +32 -10
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -1024,20 +1024,23 @@ __exportStar(__webpack_require__(/*! ./dataflow */ "./lib/dataflow/dataflow.ts")
|
|
|
1024
1024
|
//
|
|
1025
1025
|
//
|
|
1026
1026
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1027
|
-
exports.DataFlowCallback = exports.DataFlow = void 0;
|
|
1027
|
+
exports.DataFlowStamp = exports.DataFlowCallback = exports.DataFlow = void 0;
|
|
1028
1028
|
class DataFlow {
|
|
1029
1029
|
constructor() {
|
|
1030
1030
|
this.usesList = [];
|
|
1031
1031
|
}
|
|
1032
1032
|
// override in subclass
|
|
1033
|
-
|
|
1033
|
+
dfid() { return null; }
|
|
1034
|
+
// override in subclass
|
|
1035
|
+
compute() {
|
|
1036
|
+
}
|
|
1034
1037
|
uses(df, name) {
|
|
1035
1038
|
this.usesList.push({ name: name, df: df });
|
|
1036
1039
|
}
|
|
1037
1040
|
usesStale() {
|
|
1038
1041
|
let isstale = false;
|
|
1039
1042
|
this.usesList.forEach(ui => {
|
|
1040
|
-
ui.wasstale = ui.id !== ui.df.
|
|
1043
|
+
ui.wasstale = ui.id !== ui.df.dfid();
|
|
1041
1044
|
if (ui.wasstale)
|
|
1042
1045
|
isstale = true;
|
|
1043
1046
|
});
|
|
@@ -1048,7 +1051,7 @@ class DataFlow {
|
|
|
1048
1051
|
return ui != null && ui.wasstale;
|
|
1049
1052
|
}
|
|
1050
1053
|
usesRemember() {
|
|
1051
|
-
this.usesList.forEach(ui => { ui.id = ui.df.
|
|
1054
|
+
this.usesList.forEach(ui => { ui.id = ui.df.dfid(); });
|
|
1052
1055
|
}
|
|
1053
1056
|
ifcompute() {
|
|
1054
1057
|
if (this.usesStale()) {
|
|
@@ -1056,8 +1059,6 @@ class DataFlow {
|
|
|
1056
1059
|
this.compute();
|
|
1057
1060
|
}
|
|
1058
1061
|
}
|
|
1059
|
-
compute() {
|
|
1060
|
-
}
|
|
1061
1062
|
}
|
|
1062
1063
|
exports.DataFlow = DataFlow;
|
|
1063
1064
|
// Takes callback that, eventually, returns non-null. The return value is both the value and the id.
|
|
@@ -1067,10 +1068,20 @@ class DataFlowCallback extends DataFlow {
|
|
|
1067
1068
|
super();
|
|
1068
1069
|
this._cb = cb;
|
|
1069
1070
|
}
|
|
1070
|
-
|
|
1071
|
+
dfid() { if (!this._value)
|
|
1071
1072
|
this._value = this._cb(); return this._value; }
|
|
1072
1073
|
}
|
|
1073
1074
|
exports.DataFlowCallback = DataFlowCallback;
|
|
1075
|
+
// Simple helper that maintains a simple monotonically increasing stamp
|
|
1076
|
+
class DataFlowStamp extends DataFlow {
|
|
1077
|
+
constructor() {
|
|
1078
|
+
super();
|
|
1079
|
+
this._stamp = 0;
|
|
1080
|
+
}
|
|
1081
|
+
dfid() { return this._stamp; }
|
|
1082
|
+
stamp() { this._stamp++; }
|
|
1083
|
+
}
|
|
1084
|
+
exports.DataFlowStamp = DataFlowStamp;
|
|
1074
1085
|
|
|
1075
1086
|
|
|
1076
1087
|
/***/ }),
|