@dra2020/baseclient 1.0.73 → 1.0.75

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.
@@ -1027,68 +1027,48 @@ __exportStar(__webpack_require__(/*! ./dataflow */ "./lib/dataflow/dataflow.ts")
1027
1027
  //
1028
1028
  //
1029
1029
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1030
- exports.DataFlowNonNull = exports.DataFlow = void 0;
1030
+ exports.DataFlowCallback = exports.DataFlow = void 0;
1031
1031
  class DataFlow {
1032
1032
  constructor() {
1033
- this.usesList = {};
1034
- this.uniquename = 1;
1033
+ this.usesList = [];
1035
1034
  }
1036
1035
  // override in subclass
1037
- ready() { return this.usesReady(); }
1038
1036
  id() { return null; }
1039
1037
  value() { return null; }
1040
- uses(df, name) {
1041
- if (!name)
1042
- name = `_df_${this.uniquename++}`;
1043
- this.usesList[name] = { name: name, df: df };
1044
- }
1045
- find(name) {
1046
- let ui = this.usesList[name];
1047
- return ui ? ui.df : undefined;
1048
- }
1049
- findValue(name) {
1050
- let df = this.find(name);
1051
- return df ? df.value() : undefined;
1052
- }
1053
- usesReady() {
1054
- let isready = true;
1055
- Object.values(this.usesList).forEach((ui) => { if (!ui.df.ready())
1056
- isready = false; });
1057
- return isready;
1038
+ uses(df) {
1039
+ this.usesList.push({ df: df });
1058
1040
  }
1059
1041
  usesStale() {
1060
1042
  let isstale = false;
1061
- Object.values(this.usesList).forEach((ui) => { if (ui.df.id !== ui.df.id())
1043
+ this.usesList.forEach(ui => { if (ui.id !== ui.df.id())
1062
1044
  isstale = true; });
1063
1045
  return isstale;
1064
1046
  }
1065
1047
  usesRemember() {
1066
- Object.values(this.usesList).forEach((ui) => { ui.df.id = ui.df.id(); });
1048
+ this.usesList.forEach(ui => { ui.id = ui.df.id(); });
1049
+ }
1050
+ ifcompute() {
1051
+ if (this.usesStale()) {
1052
+ this.usesRemember();
1053
+ this.compute();
1054
+ }
1055
+ }
1056
+ compute() {
1067
1057
  }
1068
1058
  }
1069
1059
  exports.DataFlow = DataFlow;
1070
- // Takes callback that, when ready, returns non-null. The return value is both the value and the id.
1071
- class DataFlowNonNull extends DataFlow {
1060
+ // Takes callback that, eventually, returns non-null. The return value is both the value and the id.
1061
+ // Once the value returns non-null, the callback is never called again.
1062
+ class DataFlowCallback extends DataFlow {
1072
1063
  constructor(cb) {
1073
1064
  super();
1074
1065
  this._cb = cb;
1075
1066
  }
1076
- ready() {
1077
- // Allow chaining
1078
- if (!this.usesReady())
1079
- return false;
1080
- // Real core semantics, with chaining on stale
1081
- if (!this._value || this.usesStale()) {
1082
- this._value = this._cb();
1083
- if (this._value)
1084
- this.usesRemember();
1085
- }
1086
- return !!this._value;
1087
- }
1088
- id() { return this.ready(), this._value; }
1089
- value() { return this.ready(), this._value; }
1067
+ id() { if (!this._value)
1068
+ this._value = this._cb(); return this._value; }
1069
+ value() { return this.id(); }
1090
1070
  }
1091
- exports.DataFlowNonNull = DataFlowNonNull;
1071
+ exports.DataFlowCallback = DataFlowCallback;
1092
1072
 
1093
1073
 
1094
1074
  /***/ }),