silentium 0.0.222 → 0.0.224
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/CHANGELOG.md +9 -0
- package/dist/silentium.cjs +140 -104
- package/dist/silentium.cjs.map +1 -1
- package/dist/silentium.d.ts +4 -1
- package/dist/silentium.js +140 -105
- package/dist/silentium.js.map +1 -1
- package/dist/silentium.min.js +1 -1
- package/dist/silentium.min.mjs +1 -1
- package/dist/silentium.min.mjs.map +1 -1
- package/dist/silentium.mjs +140 -105
- package/dist/silentium.mjs.map +1 -1
- package/eslint.config.mjs +10 -0
- package/package.json +2 -1
- package/src/base/Connected.ts +2 -2
- package/src/base/DestroyContainer.ts +6 -3
- package/src/base/Local.ts +2 -2
- package/src/base/Locals.ts +3 -1
- package/src/base/Message.test.ts +1 -1
- package/src/base/Message.ts +1 -1
- package/src/base/Rejections.ts +16 -11
- package/src/base/Silence.ts +10 -2
- package/src/base/Source.ts +3 -2
- package/src/base/SourceComputed.ts +6 -2
- package/src/components/All.ts +2 -2
- package/src/components/Any.ts +1 -1
- package/src/components/Applied.ts +1 -1
- package/src/components/Catch.ts +1 -1
- package/src/components/Chain.test.ts +1 -3
- package/src/components/Chain.ts +1 -1
- package/src/components/Context.ts +7 -6
- package/src/components/ContextChain.ts +1 -1
- package/src/components/ContextOf.ts +1 -1
- package/src/components/Default.ts +1 -1
- package/src/components/Empty.ts +2 -2
- package/src/components/ExecutorApplied.ts +1 -1
- package/src/components/Filtered.ts +1 -1
- package/src/components/Fold.ts +3 -1
- package/src/components/Freeze.ts +2 -2
- package/src/components/FromEvent.ts +14 -12
- package/src/components/Late.ts +11 -9
- package/src/components/Lazy.ts +2 -2
- package/src/components/Map.test.ts +1 -1
- package/src/components/Map.ts +3 -3
- package/src/components/Once.ts +2 -2
- package/src/components/Piped.ts +1 -1
- package/src/components/Primitive.ts +3 -2
- package/src/components/Process.ts +3 -3
- package/src/components/Promisify.ts +1 -1
- package/src/components/Race.ts +3 -3
- package/src/components/Sequence.ts +2 -2
- package/src/components/Shared.ts +12 -10
- package/src/components/Stream.ts +3 -3
- package/src/components/Trackable.ts +1 -1
- package/src/helpers/DevTools.ts +8 -3
- package/src/testing/wait.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.224](https://github.com/silentium-lab/silentium/compare/v0.0.223...v0.0.224) (2026-04-02)
|
|
6
|
+
|
|
7
|
+
### [0.0.223](https://github.com/silentium-lab/silentium/compare/v0.0.222...v0.0.223) (2026-04-01)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* return back silence logic of values ([f6cbe38](https://github.com/silentium-lab/silentium/commit/f6cbe3872aa06d79b6b327fa2336fa03389b3c73))
|
|
13
|
+
|
|
5
14
|
### [0.0.222](https://github.com/silentium-lab/silentium/compare/v0.0.221...v0.0.222) (2026-04-01)
|
|
6
15
|
|
|
7
16
|
|
package/dist/silentium.cjs
CHANGED
|
@@ -60,14 +60,17 @@ class DestroyContainerImpl {
|
|
|
60
60
|
* @returns
|
|
61
61
|
*/
|
|
62
62
|
many(destroyableList) {
|
|
63
|
-
|
|
63
|
+
const destroyMany = (d) => {
|
|
64
64
|
this.add(d);
|
|
65
|
-
}
|
|
65
|
+
};
|
|
66
|
+
destroyableList.forEach(destroyMany);
|
|
66
67
|
return this;
|
|
67
68
|
}
|
|
68
69
|
destroy() {
|
|
69
70
|
this._destroyed = true;
|
|
70
|
-
this.destructors.forEach((d)
|
|
71
|
+
this.destructors.forEach(function dcDestroy(d) {
|
|
72
|
+
d.destroy();
|
|
73
|
+
});
|
|
71
74
|
this.destructors.length = 0;
|
|
72
75
|
return this;
|
|
73
76
|
}
|
|
@@ -89,9 +92,10 @@ const _RejectionsImpl = class _RejectionsImpl {
|
|
|
89
92
|
constructor() {
|
|
90
93
|
__publicField$5(this, "catchers", []);
|
|
91
94
|
__publicField$5(this, "lastRejectReason", null);
|
|
92
|
-
__publicField$5(this, "reject"
|
|
95
|
+
__publicField$5(this, "reject");
|
|
96
|
+
const rejectionsRejectHandler = (reason) => {
|
|
93
97
|
this.lastRejectReason = reason;
|
|
94
|
-
this.catchers.forEach((catcher)
|
|
98
|
+
this.catchers.forEach(function rejectionsRejectCatchers(catcher) {
|
|
95
99
|
catcher(reason);
|
|
96
100
|
});
|
|
97
101
|
if (_RejectionsImpl.globalCatch) {
|
|
@@ -99,7 +103,8 @@ const _RejectionsImpl = class _RejectionsImpl {
|
|
|
99
103
|
} else if (this.catchers.length === 0) {
|
|
100
104
|
console.error(["Unhandled Message Rejection:", reason].join(" "));
|
|
101
105
|
}
|
|
102
|
-
}
|
|
106
|
+
};
|
|
107
|
+
this.reject = rejectionsRejectHandler;
|
|
103
108
|
}
|
|
104
109
|
catch(rejected) {
|
|
105
110
|
if (this.lastRejectReason !== null) {
|
|
@@ -130,9 +135,10 @@ class PrimitiveImpl {
|
|
|
130
135
|
}
|
|
131
136
|
ensureTouched() {
|
|
132
137
|
if (!this.touched) {
|
|
133
|
-
|
|
138
|
+
const primitiveBaseSub = (v) => {
|
|
134
139
|
this.theValue = v;
|
|
135
|
-
}
|
|
140
|
+
};
|
|
141
|
+
this.$base.then(primitiveBaseSub);
|
|
136
142
|
}
|
|
137
143
|
this.touched = true;
|
|
138
144
|
}
|
|
@@ -153,9 +159,16 @@ class PrimitiveImpl {
|
|
|
153
159
|
}
|
|
154
160
|
}
|
|
155
161
|
|
|
162
|
+
const ResetSilenceCache = Symbol("reset-silence-cache");
|
|
156
163
|
function Silence(resolve) {
|
|
157
|
-
|
|
158
|
-
|
|
164
|
+
let lastValue;
|
|
165
|
+
return function SilenceImpl(v) {
|
|
166
|
+
if (v === ResetSilenceCache) {
|
|
167
|
+
lastValue = void 0;
|
|
168
|
+
v = void 0;
|
|
169
|
+
}
|
|
170
|
+
if (isFilled(v) && v !== lastValue) {
|
|
171
|
+
lastValue = v;
|
|
159
172
|
resolve(v);
|
|
160
173
|
}
|
|
161
174
|
};
|
|
@@ -222,7 +235,7 @@ class MessageImpl {
|
|
|
222
235
|
this.dc.add(newMessage);
|
|
223
236
|
try {
|
|
224
237
|
const mbDestructor = this.executor(
|
|
225
|
-
Silence((value)
|
|
238
|
+
Silence(function messageResolver(value) {
|
|
226
239
|
if (!newMessageDc.destroyed()) {
|
|
227
240
|
resolve(value);
|
|
228
241
|
}
|
|
@@ -275,9 +288,9 @@ function Connected(main, ...m) {
|
|
|
275
288
|
const dc = DestroyContainer();
|
|
276
289
|
dc.add(main);
|
|
277
290
|
dc.many(m);
|
|
278
|
-
return Message((resolve, reject)
|
|
291
|
+
return Message(function ConnectedImpl(resolve, reject) {
|
|
279
292
|
main.catch(reject).then(resolve);
|
|
280
|
-
m.forEach((other)
|
|
293
|
+
m.forEach(function connectedMessagesForEach(other) {
|
|
281
294
|
if (isMessage(other)) {
|
|
282
295
|
other.catch(reject);
|
|
283
296
|
}
|
|
@@ -290,20 +303,22 @@ function Local(_base) {
|
|
|
290
303
|
const $base = Actual(_base);
|
|
291
304
|
return Message(function LocalImpl(resolve, reject) {
|
|
292
305
|
let destroyed = false;
|
|
293
|
-
$base.then((v)
|
|
306
|
+
$base.then(function localBaseSub(v) {
|
|
294
307
|
if (!destroyed) {
|
|
295
308
|
resolve(v);
|
|
296
309
|
}
|
|
297
310
|
});
|
|
298
311
|
$base.catch(reject);
|
|
299
|
-
return ()
|
|
312
|
+
return function localDestructor() {
|
|
300
313
|
destroyed = true;
|
|
301
314
|
};
|
|
302
315
|
});
|
|
303
316
|
}
|
|
304
317
|
|
|
305
318
|
function Props(...messages) {
|
|
306
|
-
return messages.map((m)
|
|
319
|
+
return messages.map(function propsMap(m) {
|
|
320
|
+
return Local(m);
|
|
321
|
+
});
|
|
307
322
|
}
|
|
308
323
|
|
|
309
324
|
function New(construct) {
|
|
@@ -328,9 +343,10 @@ class SourceImpl {
|
|
|
328
343
|
}
|
|
329
344
|
use(value) {
|
|
330
345
|
if (!this.message.destroyed()) {
|
|
331
|
-
|
|
346
|
+
const sourceSilenceUse = (v) => {
|
|
332
347
|
this.sourceExecutor(v);
|
|
333
|
-
}
|
|
348
|
+
};
|
|
349
|
+
this.silenceUse.use(value, sourceSilenceUse);
|
|
334
350
|
}
|
|
335
351
|
return this;
|
|
336
352
|
}
|
|
@@ -354,8 +370,12 @@ class SourceImpl {
|
|
|
354
370
|
|
|
355
371
|
function SourceComputed(message, source) {
|
|
356
372
|
return Source(
|
|
357
|
-
(resolve, reject)
|
|
358
|
-
|
|
373
|
+
function sourceComputedMsgExecutor(resolve, reject) {
|
|
374
|
+
return message.then(resolve).catch(reject);
|
|
375
|
+
},
|
|
376
|
+
function sourceComputedSrcExecutor(v) {
|
|
377
|
+
source.use(v);
|
|
378
|
+
}
|
|
359
379
|
);
|
|
360
380
|
}
|
|
361
381
|
|
|
@@ -377,9 +397,9 @@ function All(...messages) {
|
|
|
377
397
|
resolve([]);
|
|
378
398
|
return;
|
|
379
399
|
}
|
|
380
|
-
$messages.map((m, key)
|
|
400
|
+
$messages.map(function allMessagesMap(m, key) {
|
|
381
401
|
m.catch(reject);
|
|
382
|
-
m.then((v)
|
|
402
|
+
m.then(function allMessageSub(v) {
|
|
383
403
|
filled.add(key.toString());
|
|
384
404
|
result[key] = v;
|
|
385
405
|
if (isAllFilled(filled, known)) {
|
|
@@ -393,7 +413,7 @@ function All(...messages) {
|
|
|
393
413
|
function Any(...messages) {
|
|
394
414
|
const $messages = messages.map(Actual);
|
|
395
415
|
return Message(function AnyImpl(resolve, reject) {
|
|
396
|
-
$messages.forEach((message)
|
|
416
|
+
$messages.forEach(function anyMessagesSub(message) {
|
|
397
417
|
message.catch(reject);
|
|
398
418
|
message.then(resolve);
|
|
399
419
|
});
|
|
@@ -405,7 +425,7 @@ function Applied(base, applier) {
|
|
|
405
425
|
return Message(function AppliedImpl(resolve, reject) {
|
|
406
426
|
const dc = DestroyContainer();
|
|
407
427
|
$base.catch(reject);
|
|
408
|
-
$base.then((v)
|
|
428
|
+
$base.then(function appliedBaseSub(v) {
|
|
409
429
|
const result = applier(v);
|
|
410
430
|
if (isMessage(result)) {
|
|
411
431
|
dc.destroy();
|
|
@@ -427,12 +447,12 @@ function Shared($base) {
|
|
|
427
447
|
class SharedImpl {
|
|
428
448
|
constructor($base) {
|
|
429
449
|
this.$base = $base;
|
|
430
|
-
__publicField$1(this, "resolver", (v)
|
|
450
|
+
__publicField$1(this, "resolver", function sharedImplResolver(v) {
|
|
431
451
|
this.lastV = v;
|
|
432
|
-
this.resolvers.forEach((r)
|
|
452
|
+
this.resolvers.forEach(function sharedImplResolversForEach(r) {
|
|
433
453
|
r(v);
|
|
434
454
|
});
|
|
435
|
-
});
|
|
455
|
+
}.bind(this));
|
|
436
456
|
__publicField$1(this, "lastV");
|
|
437
457
|
__publicField$1(this, "resolvers", /* @__PURE__ */ new Set());
|
|
438
458
|
__publicField$1(this, "source");
|
|
@@ -444,30 +464,32 @@ class SharedImpl {
|
|
|
444
464
|
this.silenceUse = SilenceUse(this);
|
|
445
465
|
}
|
|
446
466
|
then(resolved, rejected) {
|
|
447
|
-
const
|
|
467
|
+
const sharedMsgExecutor = (res, rej) => {
|
|
448
468
|
this.resolvers.add(res);
|
|
449
469
|
if (this.resolvers.size === 1) {
|
|
450
470
|
this.$base.then(this.resolver, rej);
|
|
451
471
|
} else if (isFilled(this.lastV)) {
|
|
452
472
|
res(this.lastV);
|
|
453
473
|
}
|
|
454
|
-
return ()
|
|
474
|
+
return function sharedMsgDestructor() {
|
|
455
475
|
this.resolvers.delete(res);
|
|
456
|
-
};
|
|
457
|
-
}
|
|
476
|
+
}.bind(this);
|
|
477
|
+
};
|
|
478
|
+
const msg$ = Message(sharedMsgExecutor).then(resolved);
|
|
458
479
|
if (rejected) {
|
|
459
480
|
msg$.catch(rejected);
|
|
460
481
|
}
|
|
461
482
|
return msg$;
|
|
462
483
|
}
|
|
463
484
|
use(value) {
|
|
464
|
-
|
|
485
|
+
const sharedUse = (v) => {
|
|
465
486
|
if (this.source) {
|
|
466
487
|
this.source.use(v);
|
|
467
488
|
} else {
|
|
468
489
|
this.resolver(v);
|
|
469
490
|
}
|
|
470
|
-
}
|
|
491
|
+
};
|
|
492
|
+
this.silenceUse.use(value, sharedUse);
|
|
471
493
|
return this;
|
|
472
494
|
}
|
|
473
495
|
catch(rejected) {
|
|
@@ -505,21 +527,22 @@ class LateImpl {
|
|
|
505
527
|
this.v = v;
|
|
506
528
|
__publicField(this, "rejections", Rejections());
|
|
507
529
|
__publicField(this, "lateR", null);
|
|
508
|
-
__publicField(this, "notify", () => {
|
|
509
|
-
if (isFilled(this.v) && this.lateR) {
|
|
510
|
-
try {
|
|
511
|
-
this.lateR(this.v);
|
|
512
|
-
} catch (e) {
|
|
513
|
-
this.rejections.reject(e);
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
530
|
__publicField(this, "silenceUse");
|
|
518
|
-
|
|
519
|
-
|
|
531
|
+
const silenceUseExecutor = (resolve) => {
|
|
532
|
+
if (this.v !== void 0) {
|
|
520
533
|
resolve(this.v);
|
|
521
|
-
}
|
|
522
|
-
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
this.silenceUse = SilenceUse(Message(silenceUseExecutor));
|
|
537
|
+
}
|
|
538
|
+
notify() {
|
|
539
|
+
if (isFilled(this.v) && this.lateR) {
|
|
540
|
+
try {
|
|
541
|
+
this.lateR(this.v);
|
|
542
|
+
} catch (e) {
|
|
543
|
+
this.rejections.reject(e);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
523
546
|
}
|
|
524
547
|
then(r) {
|
|
525
548
|
if (this.lateR) {
|
|
@@ -532,10 +555,11 @@ class LateImpl {
|
|
|
532
555
|
return this;
|
|
533
556
|
}
|
|
534
557
|
use(value) {
|
|
535
|
-
|
|
558
|
+
const silenceUseLateExecutor = (v) => {
|
|
536
559
|
this.v = v;
|
|
537
560
|
this.notify();
|
|
538
|
-
}
|
|
561
|
+
};
|
|
562
|
+
this.silenceUse.use(value, silenceUseLateExecutor);
|
|
539
563
|
return this;
|
|
540
564
|
}
|
|
541
565
|
catch(rejected) {
|
|
@@ -556,7 +580,7 @@ function Catch($base) {
|
|
|
556
580
|
const rejections = Rejections();
|
|
557
581
|
$base.catch(rejections.reject);
|
|
558
582
|
const $error = Late();
|
|
559
|
-
rejections.catch((e)
|
|
583
|
+
rejections.catch(function catchErrorSub(e) {
|
|
560
584
|
$error.use(e);
|
|
561
585
|
});
|
|
562
586
|
return $error;
|
|
@@ -571,7 +595,7 @@ function Chain(...messages) {
|
|
|
571
595
|
const message = $messages[index];
|
|
572
596
|
message.catch(reject);
|
|
573
597
|
const next = $messages[index + 1];
|
|
574
|
-
message.then((v)
|
|
598
|
+
message.then(function chainMessageSub(v) {
|
|
575
599
|
oneMessage(v, next, index);
|
|
576
600
|
});
|
|
577
601
|
};
|
|
@@ -605,16 +629,18 @@ Context.transport = /* @__PURE__ */ new Map();
|
|
|
605
629
|
function Context(name, params = {}) {
|
|
606
630
|
const $msg = Destructured(
|
|
607
631
|
All(Actual(name), Actual(params)),
|
|
608
|
-
(name2, params2)
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
632
|
+
function contextMsgNormalize(name2, params2) {
|
|
633
|
+
return {
|
|
634
|
+
transport: name2,
|
|
635
|
+
params: params2,
|
|
636
|
+
result: void 0,
|
|
637
|
+
error: void 0
|
|
638
|
+
};
|
|
639
|
+
}
|
|
614
640
|
);
|
|
615
641
|
return Source(
|
|
616
|
-
(resolve, reject)
|
|
617
|
-
$msg.then((message)
|
|
642
|
+
function contextMsgImpl(resolve, reject) {
|
|
643
|
+
$msg.then(function contextMsgSub(message) {
|
|
618
644
|
const transport = Context.transport.get(message.transport);
|
|
619
645
|
if (transport === void 0) {
|
|
620
646
|
throw new Error(`Context: unknown transport ${message.transport}`);
|
|
@@ -632,7 +658,7 @@ function Context(name, params = {}) {
|
|
|
632
658
|
}
|
|
633
659
|
});
|
|
634
660
|
},
|
|
635
|
-
(value)
|
|
661
|
+
function contextSrcImpl(value) {
|
|
636
662
|
const msg = Primitive($msg).primitive();
|
|
637
663
|
if (msg === null) {
|
|
638
664
|
throw new Error("Context: sourcing impossible message not existed");
|
|
@@ -651,7 +677,7 @@ function Context(name, params = {}) {
|
|
|
651
677
|
|
|
652
678
|
function ContextChain(base) {
|
|
653
679
|
const $base = Actual(base);
|
|
654
|
-
return (context)
|
|
680
|
+
return function contextChainHandler(context) {
|
|
655
681
|
if (context.value && isSource(base)) {
|
|
656
682
|
base.use(context.value);
|
|
657
683
|
return;
|
|
@@ -666,7 +692,7 @@ function ContextChain(base) {
|
|
|
666
692
|
function ContextOf(transport) {
|
|
667
693
|
const $msg = Late();
|
|
668
694
|
Context.transport.set(transport, $msg.use.bind($msg));
|
|
669
|
-
return Message((resolve, reject)
|
|
695
|
+
return Message(function contextOfImpl(resolve, reject) {
|
|
670
696
|
$msg.catch(reject);
|
|
671
697
|
$msg.then(resolve);
|
|
672
698
|
});
|
|
@@ -675,21 +701,21 @@ function ContextOf(transport) {
|
|
|
675
701
|
function Default($base, _default) {
|
|
676
702
|
const $default = Actual(_default);
|
|
677
703
|
const $defaultAfterError = Applied(Catch($base), () => $default);
|
|
678
|
-
return Message((resolve)
|
|
704
|
+
return Message(function DefaultImpl(resolve) {
|
|
679
705
|
$base.then(resolve);
|
|
680
706
|
$defaultAfterError.then(resolve);
|
|
681
707
|
});
|
|
682
708
|
}
|
|
683
709
|
|
|
684
710
|
function Empty($base, after) {
|
|
685
|
-
return Message((resolve, reject)
|
|
711
|
+
return Message(function EmptyImpl(resolve, reject) {
|
|
686
712
|
const p = Primitive($base);
|
|
687
713
|
try {
|
|
688
714
|
$base.then(resolve).catch(reject);
|
|
689
715
|
if (!after) {
|
|
690
716
|
p.primitiveWithException();
|
|
691
717
|
}
|
|
692
|
-
after?.then(()
|
|
718
|
+
after?.then(function emptyAfterSub() {
|
|
693
719
|
try {
|
|
694
720
|
p.primitiveWithException();
|
|
695
721
|
} catch {
|
|
@@ -706,7 +732,7 @@ function ExecutorApplied($base, applier) {
|
|
|
706
732
|
return Message(function ExecutorAppliedImpl(resolve, reject) {
|
|
707
733
|
$base.catch(reject);
|
|
708
734
|
const sub = Destroyable($base.then(applier(resolve)));
|
|
709
|
-
return ()
|
|
735
|
+
return function executorAppliedDestroy() {
|
|
710
736
|
sub.destroy();
|
|
711
737
|
};
|
|
712
738
|
});
|
|
@@ -716,7 +742,7 @@ function Filtered(base, predicate, defaultValue) {
|
|
|
716
742
|
const $base = Actual(base);
|
|
717
743
|
return Message(function FilteredImpl(resolve, reject) {
|
|
718
744
|
$base.catch(reject);
|
|
719
|
-
$base.then((v)
|
|
745
|
+
$base.then(function filteredBaseSub(v) {
|
|
720
746
|
if (predicate(v)) {
|
|
721
747
|
resolve(v);
|
|
722
748
|
} else if (defaultValue !== void 0) {
|
|
@@ -730,7 +756,9 @@ function Fold(data, reducer, initial) {
|
|
|
730
756
|
const $data = Actual(data);
|
|
731
757
|
const $initial = Actual(initial);
|
|
732
758
|
return Computed(
|
|
733
|
-
(data2, initial2)
|
|
759
|
+
function foldComputed(data2, initial2) {
|
|
760
|
+
return data2.reduce(reducer, initial2);
|
|
761
|
+
},
|
|
734
762
|
$data,
|
|
735
763
|
$initial
|
|
736
764
|
);
|
|
@@ -740,13 +768,13 @@ function Freeze($base, $invalidate) {
|
|
|
740
768
|
let freezedValue = null;
|
|
741
769
|
return Message(function FreezeImpl(resolve, reject) {
|
|
742
770
|
$base.catch(reject);
|
|
743
|
-
$base.then((v)
|
|
771
|
+
$base.then(function freezeBaseSub(v) {
|
|
744
772
|
if (freezedValue === null) {
|
|
745
773
|
freezedValue = v;
|
|
746
774
|
}
|
|
747
775
|
resolve(freezedValue);
|
|
748
776
|
});
|
|
749
|
-
$invalidate?.then(()
|
|
777
|
+
$invalidate?.then(function freezeInvalidateSub() {
|
|
750
778
|
freezedValue = null;
|
|
751
779
|
});
|
|
752
780
|
});
|
|
@@ -757,7 +785,7 @@ function FromEvent(emitter, eventName, subscribeMethod, unsubscribeMethod) {
|
|
|
757
785
|
const $eventName = Actual(eventName);
|
|
758
786
|
const $subscribeMethod = Actual(subscribeMethod);
|
|
759
787
|
const $unsubscribeMethod = Actual(unsubscribeMethod);
|
|
760
|
-
return Message((resolve, reject)
|
|
788
|
+
return Message(function FromEventImpl(resolve, reject) {
|
|
761
789
|
$emitter.catch(reject);
|
|
762
790
|
$eventName.catch(reject);
|
|
763
791
|
$subscribeMethod.catch(reject);
|
|
@@ -768,22 +796,24 @@ function FromEvent(emitter, eventName, subscribeMethod, unsubscribeMethod) {
|
|
|
768
796
|
lastR(v);
|
|
769
797
|
}
|
|
770
798
|
};
|
|
771
|
-
All($emitter, $eventName, $subscribeMethod).then(
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
799
|
+
All($emitter, $eventName, $subscribeMethod).then(function fromEventAllSub([
|
|
800
|
+
emitter2,
|
|
801
|
+
eventName2,
|
|
802
|
+
subscribe
|
|
803
|
+
]) {
|
|
804
|
+
lastR = resolve;
|
|
805
|
+
if (!emitter2?.[subscribe]) {
|
|
806
|
+
return;
|
|
778
807
|
}
|
|
779
|
-
|
|
780
|
-
|
|
808
|
+
emitter2[subscribe](eventName2, handler);
|
|
809
|
+
});
|
|
810
|
+
return function fromEventDestroy() {
|
|
781
811
|
lastR = null;
|
|
782
812
|
if (!$unsubscribeMethod) {
|
|
783
813
|
return;
|
|
784
814
|
}
|
|
785
815
|
All($emitter, $eventName, $unsubscribeMethod).then(
|
|
786
|
-
([emitter2, eventName2, unsubscribe])
|
|
816
|
+
function fromEventDestroyAllSub([emitter2, eventName2, unsubscribe]) {
|
|
787
817
|
emitter2?.[unsubscribe]?.(eventName2, handler);
|
|
788
818
|
}
|
|
789
819
|
);
|
|
@@ -792,10 +822,10 @@ function FromEvent(emitter, eventName, subscribeMethod, unsubscribeMethod) {
|
|
|
792
822
|
}
|
|
793
823
|
|
|
794
824
|
function Lazy(constructor) {
|
|
795
|
-
return Message((resolve, reject)
|
|
825
|
+
return Message(function LazyImpl(resolve, reject) {
|
|
796
826
|
const inst = constructor();
|
|
797
827
|
inst.catch(reject).then(resolve);
|
|
798
|
-
return ()
|
|
828
|
+
return function LazyDestroy() {
|
|
799
829
|
if (isDestroyable(inst)) {
|
|
800
830
|
inst.destroy();
|
|
801
831
|
}
|
|
@@ -805,14 +835,14 @@ function Lazy(constructor) {
|
|
|
805
835
|
|
|
806
836
|
function Map$1(base, target) {
|
|
807
837
|
const $base = Actual(base);
|
|
808
|
-
return Message((resolve, reject)
|
|
838
|
+
return Message(function MapImpl(resolve, reject) {
|
|
809
839
|
$base.catch(reject);
|
|
810
840
|
const infos = [];
|
|
811
841
|
const dc = DestroyContainer();
|
|
812
|
-
$base.then((v)
|
|
842
|
+
$base.then(function mapBaseSub(v) {
|
|
813
843
|
infos.length = 0;
|
|
814
844
|
dc.destroy();
|
|
815
|
-
v.forEach((val)
|
|
845
|
+
v.forEach(function mapValueForEach(val) {
|
|
816
846
|
let $val = val;
|
|
817
847
|
if (!isMessage($val)) {
|
|
818
848
|
$val = Of($val);
|
|
@@ -827,10 +857,10 @@ function Map$1(base, target) {
|
|
|
827
857
|
}
|
|
828
858
|
|
|
829
859
|
function Once($base) {
|
|
830
|
-
return Message((resolve, reject)
|
|
860
|
+
return Message(function OnceImpl(resolve, reject) {
|
|
831
861
|
let isFilled = false;
|
|
832
862
|
$base.catch(reject);
|
|
833
|
-
$base.then((v)
|
|
863
|
+
$base.then(function onceBaseSub(v) {
|
|
834
864
|
if (!isFilled) {
|
|
835
865
|
isFilled = true;
|
|
836
866
|
resolve(v);
|
|
@@ -840,16 +870,16 @@ function Once($base) {
|
|
|
840
870
|
}
|
|
841
871
|
|
|
842
872
|
function Piped($m, ...c) {
|
|
843
|
-
return c.reduce((msg, Constructor)
|
|
873
|
+
return c.reduce(function pipedReduce(msg, Constructor) {
|
|
844
874
|
return Actual(Constructor(msg));
|
|
845
875
|
}, Actual($m));
|
|
846
876
|
}
|
|
847
877
|
|
|
848
878
|
function Process($base, builder) {
|
|
849
|
-
return Message((resolve, reject)
|
|
879
|
+
return Message(function ProcessImpl(resolve, reject) {
|
|
850
880
|
const $res = Late();
|
|
851
881
|
const dc = DestroyContainer();
|
|
852
|
-
$base.then((v)
|
|
882
|
+
$base.then(function processBaseSub(v) {
|
|
853
883
|
dc.destroy();
|
|
854
884
|
const $msg = builder(v);
|
|
855
885
|
dc.add($msg);
|
|
@@ -858,24 +888,24 @@ function Process($base, builder) {
|
|
|
858
888
|
});
|
|
859
889
|
$base.catch(reject);
|
|
860
890
|
$res.then(resolve);
|
|
861
|
-
return ()
|
|
891
|
+
return function processDestructor() {
|
|
862
892
|
dc.destroy();
|
|
863
893
|
};
|
|
864
894
|
});
|
|
865
895
|
}
|
|
866
896
|
|
|
867
897
|
function Promisify($message) {
|
|
868
|
-
return new Promise((resolve, reject)
|
|
898
|
+
return new Promise(function promisifyExecutor(resolve, reject) {
|
|
869
899
|
$message.then(resolve, reject);
|
|
870
900
|
});
|
|
871
901
|
}
|
|
872
902
|
|
|
873
903
|
function Race(...messages) {
|
|
874
904
|
const $messages = messages.map(Actual);
|
|
875
|
-
return Message((resolve, reject)
|
|
905
|
+
return Message(function RaceImpl(resolve, reject) {
|
|
876
906
|
let responded = false;
|
|
877
|
-
$messages.forEach(($message)
|
|
878
|
-
$message.catch(reject).then((v)
|
|
907
|
+
$messages.forEach(function raceMessagesForEach($message) {
|
|
908
|
+
$message.catch(reject).then(function raceMessageSub(v) {
|
|
879
909
|
if (responded === false) {
|
|
880
910
|
responded = true;
|
|
881
911
|
resolve(v);
|
|
@@ -886,10 +916,10 @@ function Race(...messages) {
|
|
|
886
916
|
}
|
|
887
917
|
|
|
888
918
|
function Sequence($base) {
|
|
889
|
-
return Message((resolve, reject)
|
|
919
|
+
return Message(function SequenceImpl(resolve, reject) {
|
|
890
920
|
const result = [];
|
|
891
921
|
$base.catch(reject);
|
|
892
|
-
$base.then((v)
|
|
922
|
+
$base.then(function sequenceBaseSub(v) {
|
|
893
923
|
result.push(v);
|
|
894
924
|
resolve(result.slice());
|
|
895
925
|
});
|
|
@@ -898,10 +928,10 @@ function Sequence($base) {
|
|
|
898
928
|
|
|
899
929
|
function Stream(base) {
|
|
900
930
|
const $base = Actual(base);
|
|
901
|
-
return Message((resolve, reject)
|
|
931
|
+
return Message(function StreamImpl(resolve, reject) {
|
|
902
932
|
$base.catch(reject);
|
|
903
|
-
$base.then((v)
|
|
904
|
-
v.forEach((cv)
|
|
933
|
+
$base.then(function streamBaseSub(v) {
|
|
934
|
+
v.forEach(function streamBaseForEach(cv) {
|
|
905
935
|
resolve(cv);
|
|
906
936
|
});
|
|
907
937
|
});
|
|
@@ -911,7 +941,7 @@ function Stream(base) {
|
|
|
911
941
|
function Trackable(name, target) {
|
|
912
942
|
Context("trackable", { name, action: "created" }).then(Void());
|
|
913
943
|
if (isMessage(target)) {
|
|
914
|
-
target.then((value)
|
|
944
|
+
target.then(function trackableTargetSub(value) {
|
|
915
945
|
Context("trackable", { name, action: "value", value }).then(Void());
|
|
916
946
|
});
|
|
917
947
|
}
|
|
@@ -941,9 +971,14 @@ function Value(target) {
|
|
|
941
971
|
}
|
|
942
972
|
|
|
943
973
|
const silentiumPrint = (...messages) => {
|
|
944
|
-
Applied(
|
|
945
|
-
|
|
946
|
-
|
|
974
|
+
Applied(
|
|
975
|
+
All(
|
|
976
|
+
...messages.map(function silentiumPrintAllMap(e) {
|
|
977
|
+
return Shared(e);
|
|
978
|
+
})
|
|
979
|
+
),
|
|
980
|
+
JSON.stringify
|
|
981
|
+
).then(console.log);
|
|
947
982
|
};
|
|
948
983
|
const silentiumValue = ($message) => Primitive($message).primitive();
|
|
949
984
|
class MessageDestroyable {
|
|
@@ -1017,6 +1052,7 @@ exports.Props = Props;
|
|
|
1017
1052
|
exports.Race = Race;
|
|
1018
1053
|
exports.Rejections = Rejections;
|
|
1019
1054
|
exports.RejectionsImpl = RejectionsImpl;
|
|
1055
|
+
exports.ResetSilenceCache = ResetSilenceCache;
|
|
1020
1056
|
exports.Sequence = Sequence;
|
|
1021
1057
|
exports.Shared = Shared;
|
|
1022
1058
|
exports.SharedImpl = SharedImpl;
|