mol_wire_lib 1.0.429 → 1.0.431

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
@@ -1032,6 +1032,12 @@ var $;
1032
1032
  //mol/wire/method/method.ts
1033
1033
  ;
1034
1034
  "use strict";
1035
+ //mol/type/tail/tail.ts
1036
+ ;
1037
+ "use strict";
1038
+ //mol/type/foot/foot.ts
1039
+ ;
1040
+ "use strict";
1035
1041
  var $;
1036
1042
  (function ($) {
1037
1043
  class $mol_wire_atom extends $mol_wire_fiber {
@@ -1085,6 +1091,20 @@ var $;
1085
1091
  once() {
1086
1092
  return this.sync();
1087
1093
  }
1094
+ channel() {
1095
+ return Object.assign((next) => {
1096
+ if (next !== undefined)
1097
+ return this.resync([...this.args, next]);
1098
+ if (!$mol_wire_fiber.warm)
1099
+ return this.result();
1100
+ if ($mol_wire_auto() instanceof $mol_wire_task) {
1101
+ return this.once();
1102
+ }
1103
+ else {
1104
+ return this.sync();
1105
+ }
1106
+ }, { atom: this });
1107
+ }
1088
1108
  destructor() {
1089
1109
  super.destructor();
1090
1110
  const prev = this.cache;
@@ -1269,9 +1289,6 @@ var $;
1269
1289
  //mol/wire/race/race.ts
1270
1290
  ;
1271
1291
  "use strict";
1272
- //mol/type/tail/tail.ts
1273
- ;
1274
- "use strict";
1275
1292
  var $;
1276
1293
  (function ($) {
1277
1294
  function $mol_wire_solo(host, field, descr) {
@@ -1500,6 +1517,22 @@ var $;
1500
1517
  //mol/wire/patch/patch.ts
1501
1518
  ;
1502
1519
  "use strict";
1520
+ //mol/type/result/result.ts
1521
+ ;
1522
+ "use strict";
1523
+ var $;
1524
+ (function ($) {
1525
+ function $mol_wire_let(host) {
1526
+ for (const field of Object.keys(host)) {
1527
+ host[field] = new $mol_wire_atom(field, host[field], host).channel();
1528
+ }
1529
+ return host;
1530
+ }
1531
+ $.$mol_wire_let = $mol_wire_let;
1532
+ })($ || ($ = {}));
1533
+ //mol/wire/let/let.ts
1534
+ ;
1535
+ "use strict";
1503
1536
  var $;
1504
1537
  (function ($) {
1505
1538
  class $mol_wire_set extends Set {
@@ -3956,6 +3989,9 @@ var $;
3956
3989
  //mol/key/key.test.tsx
3957
3990
  ;
3958
3991
  "use strict";
3992
+ //mol/type/foot/foot.test.ts
3993
+ ;
3994
+ "use strict";
3959
3995
  var $;
3960
3996
  (function ($) {
3961
3997
  $mol_wire_log.active();
@@ -4030,6 +4066,37 @@ var $;
4030
4066
  //mol/object/object.test.ts
4031
4067
  ;
4032
4068
  "use strict";
4069
+ //mol/type/result/result.test.ts
4070
+ ;
4071
+ "use strict";
4072
+ var $;
4073
+ (function ($) {
4074
+ $mol_test({
4075
+ 'define as methods'() {
4076
+ const { foo, bar } = $mol_wire_let({
4077
+ foo(next = 1) { return next; },
4078
+ bar() { return this.foo() + 1; },
4079
+ });
4080
+ $mol_assert_equal(foo(), 1);
4081
+ $mol_assert_equal(bar(), 2);
4082
+ $mol_assert_equal(foo(5), 5);
4083
+ $mol_assert_equal(bar(), 6);
4084
+ },
4085
+ 'define as closures'() {
4086
+ const { foo, bar } = $mol_wire_let({
4087
+ foo: (next = 1) => next,
4088
+ bar: () => foo() + 1,
4089
+ });
4090
+ $mol_assert_equal(foo(), 1);
4091
+ $mol_assert_equal(bar(), 2);
4092
+ $mol_assert_equal(foo(5), 5);
4093
+ $mol_assert_equal(bar(), 6);
4094
+ },
4095
+ });
4096
+ })($ || ($ = {}));
4097
+ //mol/wire/let/let.test.ts
4098
+ ;
4099
+ "use strict";
4033
4100
  var $;
4034
4101
  (function ($_1) {
4035
4102
  $mol_test({