mol_wire_lib 1.0.169 → 1.0.170

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/node.test.js CHANGED
@@ -1030,17 +1030,27 @@ var $;
1030
1030
  };
1031
1031
  }
1032
1032
  }
1033
- recall(...args) {
1034
- if (this.cursor > $mol_wire_cursor.fresh) {
1035
- try {
1036
- this.once();
1037
- }
1038
- catch (error) {
1039
- if (error instanceof Promise)
1040
- $mol_fail_hidden(error);
1041
- }
1033
+ resync(...args) {
1034
+ let res;
1035
+ try {
1036
+ res = this.recall(...args);
1037
+ }
1038
+ catch (error) {
1039
+ if (error instanceof Promise)
1040
+ $mol_fail_hidden(error);
1041
+ res = error;
1042
+ }
1043
+ try {
1044
+ this.once();
1045
+ }
1046
+ catch (error) {
1047
+ if (error instanceof Promise)
1048
+ $mol_fail_hidden(error);
1042
1049
  }
1043
- return this.put(this.task.call(this.host, ...args));
1050
+ return this.put(res);
1051
+ }
1052
+ recall(...args) {
1053
+ return this.task.call(this.host, ...args);
1044
1054
  }
1045
1055
  once() {
1046
1056
  return this.sync();
@@ -1086,6 +1096,9 @@ var $;
1086
1096
  return next;
1087
1097
  }
1088
1098
  }
1099
+ __decorate([
1100
+ $mol_wire_method
1101
+ ], $mol_wire_atom.prototype, "resync", null);
1089
1102
  __decorate([
1090
1103
  $mol_wire_method
1091
1104
  ], $mol_wire_atom.prototype, "recall", null);
@@ -1205,7 +1218,7 @@ var $;
1205
1218
  return atom.sync();
1206
1219
  }
1207
1220
  }
1208
- return atom.recall(...args);
1221
+ return atom.resync(...args);
1209
1222
  };
1210
1223
  Object.defineProperty(wrapper, 'name', { value: func.name + ' ' });
1211
1224
  Object.assign(wrapper, { orig: func });
@@ -2921,6 +2934,19 @@ var $;
2921
2934
  App.value(2);
2922
2935
  $mol_assert_equal(App.value(), 3);
2923
2936
  },
2937
+ 'Read Pushed'($) {
2938
+ class App extends $mol_object2 {
2939
+ static $ = $;
2940
+ static value(next = 0) {
2941
+ return next;
2942
+ }
2943
+ }
2944
+ __decorate([
2945
+ $mol_wire_mem(0)
2946
+ ], App, "value", null);
2947
+ $mol_assert_equal(App.value(1), 1);
2948
+ $mol_assert_equal(App.value(), 1);
2949
+ },
2924
2950
  'Mem overrides mem'($) {
2925
2951
  class Base extends $mol_object2 {
2926
2952
  static $ = $;
@@ -3091,6 +3117,33 @@ var $;
3091
3117
  ], App, "test", null);
3092
3118
  App.test();
3093
3119
  },
3120
+ 'Update deps on push'($) {
3121
+ class App extends $mol_object2 {
3122
+ static $ = $;
3123
+ static left(next = false) {
3124
+ return next;
3125
+ }
3126
+ static right(next = false) {
3127
+ return next;
3128
+ }
3129
+ static res(next) {
3130
+ return this.left(next) && this.right();
3131
+ }
3132
+ }
3133
+ __decorate([
3134
+ $mol_wire_mem(0)
3135
+ ], App, "left", null);
3136
+ __decorate([
3137
+ $mol_wire_mem(0)
3138
+ ], App, "right", null);
3139
+ __decorate([
3140
+ $mol_wire_mem(0)
3141
+ ], App, "res", null);
3142
+ $mol_assert_equal(App.res(), false);
3143
+ $mol_assert_equal(App.res(true), false);
3144
+ $mol_assert_equal(App.right(true), true);
3145
+ $mol_assert_equal(App.res(), true);
3146
+ },
3094
3147
  'Different order of pull and push'($) {
3095
3148
  class App extends $mol_object2 {
3096
3149
  static $ = $;