@fncts/observable 0.0.26 → 0.0.27
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/Observable/api/raceWith.d.ts +0 -1
- package/Observable/api/repeatWhen.d.ts +1 -1
- package/Observable/api/share.d.ts +1 -1
- package/Observable/api.d.ts +4 -4
- package/Observable/definition.d.ts +1 -4
- package/Observable.d.ts +16 -16
- package/ObservableRef.d.ts +2 -2
- package/Operator.d.ts +3 -3
- package/Subject.d.ts +14 -5
- package/Subscriber.d.ts +23 -8
- package/Subscription.d.ts +2 -2
- package/_cjs/Action.cjs +1 -1
- package/_cjs/AnimationFrameAction.cjs +2 -2
- package/_cjs/AnimationFrameScheduler.cjs +2 -2
- package/_cjs/AsyncAction.cjs +4 -4
- package/_cjs/AsyncAction.cjs.map +1 -1
- package/_cjs/AsyncScheduler.cjs +2 -2
- package/_cjs/BehaviorSubject.cjs +2 -2
- package/_cjs/BehaviorSubject.cjs.map +1 -1
- package/_cjs/Observable/api/connect.cjs +7 -7
- package/_cjs/Observable/api/connect.cjs.map +1 -1
- package/_cjs/Observable/api/connectable.cjs +4 -4
- package/_cjs/Observable/api/connectable.cjs.map +1 -1
- package/_cjs/Observable/api/fromCallback.cjs +2 -2
- package/_cjs/Observable/api/fromEvent.cjs +1 -1
- package/_cjs/Observable/api/race.cjs +4 -4
- package/_cjs/Observable/api/race.cjs.map +1 -1
- package/_cjs/Observable/api/raceWith.cjs +3 -4
- package/_cjs/Observable/api/raceWith.cjs.map +1 -1
- package/_cjs/Observable/api/repeatWhen.cjs +9 -8
- package/_cjs/Observable/api/repeatWhen.cjs.map +1 -1
- package/_cjs/Observable/api/retryWhen.cjs +9 -8
- package/_cjs/Observable/api/retryWhen.cjs.map +1 -1
- package/_cjs/Observable/api/share.cjs +9 -9
- package/_cjs/Observable/api/share.cjs.map +1 -1
- package/_cjs/Observable/api/window.cjs +12 -11
- package/_cjs/Observable/api/window.cjs.map +1 -1
- package/_cjs/Observable/api/windowCount.cjs +12 -10
- package/_cjs/Observable/api/windowCount.cjs.map +1 -1
- package/_cjs/Observable/api/windowTime.cjs +12 -11
- package/_cjs/Observable/api/windowTime.cjs.map +1 -1
- package/_cjs/Observable/api/windowToggle.cjs +26 -24
- package/_cjs/Observable/api/windowToggle.cjs.map +1 -1
- package/_cjs/Observable/api/windowWhen.cjs +17 -15
- package/_cjs/Observable/api/windowWhen.cjs.map +1 -1
- package/_cjs/Observable/api.cjs +325 -311
- package/_cjs/Observable/api.cjs.map +1 -1
- package/_cjs/Observable/definition.cjs +7 -14
- package/_cjs/Observable/definition.cjs.map +1 -1
- package/_cjs/Observable/dom/animationFrames.cjs +3 -3
- package/_cjs/Observable/dom/animationFrames.cjs.map +1 -1
- package/_cjs/Observable.cjs +64 -64
- package/_cjs/Observable.cjs.map +1 -1
- package/_cjs/ObservableRef/api.cjs +2 -2
- package/_cjs/ObservableRef/atomic.cjs +2 -2
- package/_cjs/ObservableRef/definition.cjs +1 -1
- package/_cjs/ObservableRef.cjs +8 -8
- package/_cjs/ObservableRef.cjs.map +1 -1
- package/_cjs/Operator.cjs +9 -14
- package/_cjs/Operator.cjs.map +1 -1
- package/_cjs/Scheduler.cjs +2 -2
- package/_cjs/Subject.cjs +69 -43
- package/_cjs/Subject.cjs.map +1 -1
- package/_cjs/Subscriber.cjs +122 -70
- package/_cjs/Subscriber.cjs.map +1 -1
- package/_cjs/Subscription.cjs +7 -7
- package/_cjs/Subscription.cjs.map +1 -1
- package/_cjs/config.cjs +15 -0
- package/_cjs/config.cjs.map +1 -0
- package/_cjs/index.cjs +13 -13
- package/_cjs/internal/animationFrameProvider.cjs +1 -1
- package/_cjs/internal/args.cjs +1 -1
- package/_cjs/internal/util.cjs +2 -2
- package/_mjs/AsyncAction.mjs +3 -3
- package/_mjs/AsyncAction.mjs.map +1 -1
- package/_mjs/BehaviorSubject.mjs +1 -1
- package/_mjs/BehaviorSubject.mjs.map +1 -1
- package/_mjs/Observable/api/connect.mjs +6 -6
- package/_mjs/Observable/api/connect.mjs.map +1 -1
- package/_mjs/Observable/api/connectable.mjs +1 -1
- package/_mjs/Observable/api/connectable.mjs.map +1 -1
- package/_mjs/Observable/api/race.mjs +1 -1
- package/_mjs/Observable/api/race.mjs.map +1 -1
- package/_mjs/Observable/api/raceWith.mjs +3 -4
- package/_mjs/Observable/api/raceWith.mjs.map +1 -1
- package/_mjs/Observable/api/repeatWhen.mjs +9 -8
- package/_mjs/Observable/api/repeatWhen.mjs.map +1 -1
- package/_mjs/Observable/api/retryWhen.mjs +9 -8
- package/_mjs/Observable/api/retryWhen.mjs.map +1 -1
- package/_mjs/Observable/api/share.mjs +8 -8
- package/_mjs/Observable/api/share.mjs.map +1 -1
- package/_mjs/Observable/api/window.mjs +12 -11
- package/_mjs/Observable/api/window.mjs.map +1 -1
- package/_mjs/Observable/api/windowCount.mjs +12 -10
- package/_mjs/Observable/api/windowCount.mjs.map +1 -1
- package/_mjs/Observable/api/windowTime.mjs +11 -10
- package/_mjs/Observable/api/windowTime.mjs.map +1 -1
- package/_mjs/Observable/api/windowToggle.mjs +25 -23
- package/_mjs/Observable/api/windowToggle.mjs.map +1 -1
- package/_mjs/Observable/api/windowWhen.mjs +17 -15
- package/_mjs/Observable/api/windowWhen.mjs.map +1 -1
- package/_mjs/Observable/api.mjs +304 -290
- package/_mjs/Observable/api.mjs.map +1 -1
- package/_mjs/Observable/definition.mjs +2 -9
- package/_mjs/Observable/definition.mjs.map +1 -1
- package/_mjs/Observable/dom/animationFrames.mjs +1 -1
- package/_mjs/Observable/dom/animationFrames.mjs.map +1 -1
- package/_mjs/Observable.mjs +16 -18
- package/_mjs/Observable.mjs.map +1 -1
- package/_mjs/ObservableRef.mjs +2 -3
- package/_mjs/ObservableRef.mjs.map +1 -1
- package/_mjs/Operator.mjs +6 -11
- package/_mjs/Operator.mjs.map +1 -1
- package/_mjs/Subject.mjs +65 -39
- package/_mjs/Subject.mjs.map +1 -1
- package/_mjs/Subscriber.mjs +119 -67
- package/_mjs/Subscriber.mjs.map +1 -1
- package/_mjs/Subscription.mjs +6 -6
- package/_mjs/Subscription.mjs.map +1 -1
- package/_mjs/config.mjs +9 -0
- package/_mjs/config.mjs.map +1 -0
- package/_src/AsyncAction.ts +3 -3
- package/_src/BehaviorSubject.ts +1 -1
- package/_src/Observable/api/connect.ts +2 -2
- package/_src/Observable/api/connectable.ts +1 -1
- package/_src/Observable/api/race.ts +1 -1
- package/_src/Observable/api/raceWith.ts +2 -5
- package/_src/Observable/api/repeatWhen.ts +4 -4
- package/_src/Observable/api/retryWhen.ts +3 -3
- package/_src/Observable/api/share.ts +6 -6
- package/_src/Observable/api/window.ts +3 -3
- package/_src/Observable/api/windowCount.ts +30 -33
- package/_src/Observable/api/windowTime.ts +4 -4
- package/_src/Observable/api/windowToggle.ts +19 -21
- package/_src/Observable/api/windowWhen.ts +10 -13
- package/_src/Observable/api.ts +358 -363
- package/_src/Observable/definition.ts +2 -17
- package/_src/Observable/dom/animationFrames.ts +1 -1
- package/_src/Observable.ts +17 -18
- package/_src/ObservableRef.ts +2 -3
- package/_src/Operator.ts +9 -21
- package/_src/Subject.ts +66 -39
- package/_src/Subscriber.ts +134 -59
- package/_src/Subscription.ts +8 -8
- package/_src/config.ts +40 -0
- package/_src/global.ts +1 -1
- package/config.d.ts +36 -0
- package/global.d.ts +1 -1
- package/package.json +2 -2
package/_mjs/Observable/api.mjs
CHANGED
|
@@ -145,7 +145,7 @@ function from_1(input) {
|
|
|
145
145
|
}
|
|
146
146
|
export function fromArrayLike(input) {
|
|
147
147
|
return new Observable(s => {
|
|
148
|
-
for (let i = 0; i < input.length && !s.
|
|
148
|
+
for (let i = 0; i < input.length && !s._closed; i++) {
|
|
149
149
|
s.next(input[i]);
|
|
150
150
|
}
|
|
151
151
|
s.complete();
|
|
@@ -160,7 +160,7 @@ export function fromIterable(iterable) {
|
|
|
160
160
|
return new Observable(s => {
|
|
161
161
|
for (const value of iterable) {
|
|
162
162
|
s.next(value);
|
|
163
|
-
if (s.
|
|
163
|
+
if (s._closed) {
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
@@ -170,7 +170,7 @@ export function fromIterable(iterable) {
|
|
|
170
170
|
export function fromPromise(promise) {
|
|
171
171
|
return new Observable(s => {
|
|
172
172
|
promise.then(value => {
|
|
173
|
-
if (!s.
|
|
173
|
+
if (!s._closed) {
|
|
174
174
|
s.next(value);
|
|
175
175
|
s.complete();
|
|
176
176
|
}
|
|
@@ -214,7 +214,7 @@ export function iterate(options) {
|
|
|
214
214
|
async function process(asyncIterable, subscriber) {
|
|
215
215
|
for await (const value of asyncIterable) {
|
|
216
216
|
subscriber.next(value);
|
|
217
|
-
if (subscriber.
|
|
217
|
+
if (subscriber._closed) {
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
@@ -280,7 +280,7 @@ export function scheduleArray(input, scheduler) {
|
|
|
280
280
|
s.complete();
|
|
281
281
|
} else {
|
|
282
282
|
s.next(input[i++]);
|
|
283
|
-
if (!s.
|
|
283
|
+
if (!s._closed) {
|
|
284
284
|
this.schedule();
|
|
285
285
|
}
|
|
286
286
|
}
|
|
@@ -378,7 +378,7 @@ function timer_1(time = 0, intervalOrScheduler, scheduler = tsplus_module_5.asyn
|
|
|
378
378
|
}
|
|
379
379
|
let n = 0;
|
|
380
380
|
return scheduler.schedule(function () {
|
|
381
|
-
if (!s.
|
|
381
|
+
if (!s._closed) {
|
|
382
382
|
s.next(n++);
|
|
383
383
|
if (0 <= intervalDuration) {
|
|
384
384
|
this.schedule(undefined, intervalDuration);
|
|
@@ -399,7 +399,7 @@ export function makeZip(...sources) {
|
|
|
399
399
|
subscriber.add(() => {
|
|
400
400
|
buffers = completed = null;
|
|
401
401
|
});
|
|
402
|
-
for (let sourceIndex = 0; !subscriber.
|
|
402
|
+
for (let sourceIndex = 0; !subscriber._closed && sourceIndex < sources.length; sourceIndex++) {
|
|
403
403
|
from_1(sources[sourceIndex]).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
404
404
|
next: value => {
|
|
405
405
|
buffers[sourceIndex].push(value);
|
|
@@ -431,7 +431,7 @@ function fromIO_1(io, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
431
431
|
const scheduled = scheduler.schedule(() => {
|
|
432
432
|
fiber = tsplus_module_10.unsafeRunFiber(tsplus_module_9.provideEnvironment(env, fileName_1 + ":487:36")(io), fileName_1 + ":487:56");
|
|
433
433
|
fiber.addObserver(exit => {
|
|
434
|
-
if (!s.
|
|
434
|
+
if (!s._closed) {
|
|
435
435
|
tsplus_module_11.match(cause => s.error(cause), a => s.next(a))(exit);
|
|
436
436
|
s.complete();
|
|
437
437
|
}
|
|
@@ -476,14 +476,14 @@ export function ap(fa) {
|
|
|
476
476
|
*/
|
|
477
477
|
function mapWithIndex_1(f) {
|
|
478
478
|
return fa => {
|
|
479
|
-
return
|
|
479
|
+
return new Observable((destination, environment) => {
|
|
480
480
|
let i = 0;
|
|
481
|
-
|
|
481
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
482
482
|
next: value => {
|
|
483
|
-
|
|
483
|
+
destination.next(f(i++, value));
|
|
484
484
|
}
|
|
485
|
-
}));
|
|
486
|
-
})
|
|
485
|
+
})(destination));
|
|
486
|
+
});
|
|
487
487
|
};
|
|
488
488
|
}
|
|
489
489
|
/**
|
|
@@ -507,21 +507,21 @@ function as_1(b) {
|
|
|
507
507
|
*/
|
|
508
508
|
export function mapError(f) {
|
|
509
509
|
return fa => {
|
|
510
|
-
return
|
|
511
|
-
|
|
510
|
+
return new Observable((subscriber, environment) => {
|
|
511
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
512
512
|
error: err => {
|
|
513
513
|
subscriber.error(tsplus_module_1.map(f)(err));
|
|
514
514
|
}
|
|
515
|
-
}));
|
|
516
|
-
})
|
|
515
|
+
})(subscriber));
|
|
516
|
+
});
|
|
517
517
|
};
|
|
518
518
|
}
|
|
519
519
|
/**
|
|
520
520
|
* @tsplus getter fncts.observable.Observable swap
|
|
521
521
|
*/
|
|
522
522
|
export function swap(fa) {
|
|
523
|
-
return
|
|
524
|
-
|
|
523
|
+
return new Observable((subscriber, environment) => {
|
|
524
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
525
525
|
next: value => {
|
|
526
526
|
subscriber.error(tsplus_module_1.fail(value));
|
|
527
527
|
},
|
|
@@ -532,17 +532,17 @@ export function swap(fa) {
|
|
|
532
532
|
subscriber.error(cause);
|
|
533
533
|
})(tsplus_module_1.failureOrCause(err));
|
|
534
534
|
}
|
|
535
|
-
}));
|
|
536
|
-
})
|
|
535
|
+
})(subscriber));
|
|
536
|
+
});
|
|
537
537
|
}
|
|
538
538
|
function filterWithIndex_1(predicate) {
|
|
539
539
|
return fa => {
|
|
540
|
-
return
|
|
540
|
+
return new Observable((subscriber, environment) => {
|
|
541
541
|
let index = 0;
|
|
542
|
-
|
|
542
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
543
543
|
next: value => predicate(index++, value) && subscriber.next(value)
|
|
544
|
-
}));
|
|
545
|
-
})
|
|
544
|
+
})(subscriber));
|
|
545
|
+
});
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
548
|
export function filter(predicate) {
|
|
@@ -555,12 +555,12 @@ export function filter(predicate) {
|
|
|
555
555
|
*/
|
|
556
556
|
function filterMapWithIndex_1(f) {
|
|
557
557
|
return fa => {
|
|
558
|
-
return
|
|
558
|
+
return new Observable((subscriber, environment) => {
|
|
559
559
|
let index = 0;
|
|
560
|
-
|
|
560
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
561
561
|
next: value => tsplus_module_15.match(() => tsplus_module_2.noop, b => subscriber.next(b))(f(index++, value))
|
|
562
|
-
}));
|
|
563
|
-
})
|
|
562
|
+
})(subscriber));
|
|
563
|
+
});
|
|
564
564
|
};
|
|
565
565
|
}
|
|
566
566
|
/**
|
|
@@ -586,21 +586,21 @@ export function partition(predicate) {
|
|
|
586
586
|
*/
|
|
587
587
|
function partitionMapWithIndex_1(f) {
|
|
588
588
|
return fa => {
|
|
589
|
-
return [
|
|
589
|
+
return [new Observable((subscriber, environment) => {
|
|
590
590
|
let index = 0;
|
|
591
|
-
|
|
591
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
592
592
|
next: value => {
|
|
593
593
|
tsplus_module_14.match(b => subscriber.next(b), tsplus_module_2.noop)(f(index++, value));
|
|
594
594
|
}
|
|
595
|
-
}));
|
|
596
|
-
})
|
|
595
|
+
})(subscriber));
|
|
596
|
+
}), new Observable((subscriber, environment) => {
|
|
597
597
|
let index = 0;
|
|
598
|
-
|
|
598
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
599
599
|
next: value => {
|
|
600
600
|
tsplus_module_14.match(tsplus_module_2.noop, c => subscriber.next(c))(f(index++, value));
|
|
601
601
|
}
|
|
602
|
-
}));
|
|
603
|
-
})
|
|
602
|
+
})(subscriber));
|
|
603
|
+
})];
|
|
604
604
|
};
|
|
605
605
|
}
|
|
606
606
|
/**
|
|
@@ -624,7 +624,9 @@ export function provideService(service, /** @tsplus auto */tag) {
|
|
|
624
624
|
*/
|
|
625
625
|
function mergeMapWithIndex_1(f, concurrent = Infinity) {
|
|
626
626
|
return ma => {
|
|
627
|
-
return
|
|
627
|
+
return new Observable((subscriber, environment) => {
|
|
628
|
+
return mergeInternal(ma, subscriber, environment, f, concurrent);
|
|
629
|
+
});
|
|
628
630
|
};
|
|
629
631
|
}
|
|
630
632
|
/**
|
|
@@ -670,7 +672,9 @@ export function flatten(mma) {
|
|
|
670
672
|
*/
|
|
671
673
|
function foldLeftWithIndex_1(initial, f) {
|
|
672
674
|
return fa => {
|
|
673
|
-
return
|
|
675
|
+
return new Observable((subscriber, environment) => {
|
|
676
|
+
return scanInternal(fa, subscriber, environment, f, initial, true, false, true);
|
|
677
|
+
});
|
|
674
678
|
};
|
|
675
679
|
}
|
|
676
680
|
/**
|
|
@@ -686,7 +690,7 @@ function foldLeft_1(initial, f) {
|
|
|
686
690
|
*/
|
|
687
691
|
export function at(index) {
|
|
688
692
|
return fa => {
|
|
689
|
-
return onEmpty_1(() => tsplus_module_17.nothing(fileName_1 + ":
|
|
693
|
+
return onEmpty_1(() => tsplus_module_17.nothing(fileName_1 + ":843:29"))(map_1(tsplus_module_17.just)(take_1(1)(filterWithIndex_1(i => i === index)(fa))));
|
|
690
694
|
};
|
|
691
695
|
}
|
|
692
696
|
/**
|
|
@@ -694,8 +698,8 @@ export function at(index) {
|
|
|
694
698
|
*/
|
|
695
699
|
function audit_1(durationSelector) {
|
|
696
700
|
return fa => {
|
|
697
|
-
return
|
|
698
|
-
let lastValue = tsplus_module_17.nothing(fileName_1 + ":
|
|
701
|
+
return new Observable((subscriber, environment) => {
|
|
702
|
+
let lastValue = tsplus_module_17.nothing(fileName_1 + ":853:40");
|
|
699
703
|
let durationSubscriber = null;
|
|
700
704
|
let isComplete = false;
|
|
701
705
|
const endDuration = () => {
|
|
@@ -705,7 +709,7 @@ function audit_1(durationSelector) {
|
|
|
705
709
|
const {
|
|
706
710
|
value
|
|
707
711
|
} = lastValue;
|
|
708
|
-
lastValue = tsplus_module_17.nothing(fileName_1 + ":
|
|
712
|
+
lastValue = tsplus_module_17.nothing(fileName_1 + ":861:36");
|
|
709
713
|
subscriber.next(value);
|
|
710
714
|
}
|
|
711
715
|
isComplete && subscriber.complete();
|
|
@@ -714,9 +718,9 @@ function audit_1(durationSelector) {
|
|
|
714
718
|
durationSubscriber = null;
|
|
715
719
|
isComplete && subscriber.complete();
|
|
716
720
|
};
|
|
717
|
-
|
|
721
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
718
722
|
next: value => {
|
|
719
|
-
lastValue = tsplus_module_17.just(value, fileName_1 + ":
|
|
723
|
+
lastValue = tsplus_module_17.just(value, fileName_1 + ":873:29");
|
|
720
724
|
if (!durationSubscriber) {
|
|
721
725
|
from_1(durationSelector(value)).provideEnvironment(environment).subscribe(durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
722
726
|
next: endDuration,
|
|
@@ -726,10 +730,10 @@ function audit_1(durationSelector) {
|
|
|
726
730
|
},
|
|
727
731
|
complete: () => {
|
|
728
732
|
isComplete = true;
|
|
729
|
-
(tsplus_module_18.isNothing(lastValue) || !durationSubscriber || durationSubscriber.
|
|
733
|
+
(tsplus_module_18.isNothing(lastValue) || !durationSubscriber || durationSubscriber._closed) && subscriber.complete();
|
|
730
734
|
}
|
|
731
735
|
}));
|
|
732
|
-
})
|
|
736
|
+
});
|
|
733
737
|
};
|
|
734
738
|
}
|
|
735
739
|
/**
|
|
@@ -745,27 +749,27 @@ export function auditTime(duration, scheduler = tsplus_module_5.asyncScheduler)
|
|
|
745
749
|
*/
|
|
746
750
|
export function buffer(closingNotifier) {
|
|
747
751
|
return fa => {
|
|
748
|
-
return
|
|
752
|
+
return new Observable((subscriber, environment) => {
|
|
749
753
|
let buffer = [];
|
|
750
|
-
|
|
754
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
751
755
|
next: value => buffer.push(value),
|
|
752
756
|
complete: () => {
|
|
753
757
|
subscriber.next(buffer);
|
|
754
758
|
subscriber.complete();
|
|
755
759
|
}
|
|
756
|
-
}));
|
|
757
|
-
closingNotifier.provideEnvironment(environment).subscribe(tsplus_module_8.
|
|
760
|
+
})(subscriber));
|
|
761
|
+
closingNotifier.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
758
762
|
next: () => {
|
|
759
763
|
const b = buffer;
|
|
760
764
|
buffer = [];
|
|
761
765
|
subscriber.next(b);
|
|
762
766
|
},
|
|
763
767
|
complete: tsplus_module_2.noop
|
|
764
|
-
}));
|
|
768
|
+
})(subscriber));
|
|
765
769
|
return () => {
|
|
766
770
|
buffer = null;
|
|
767
771
|
};
|
|
768
|
-
})
|
|
772
|
+
});
|
|
769
773
|
};
|
|
770
774
|
}
|
|
771
775
|
/**
|
|
@@ -774,10 +778,10 @@ export function buffer(closingNotifier) {
|
|
|
774
778
|
export function bufferCount(bufferSize, startBufferEvery) {
|
|
775
779
|
return fa => {
|
|
776
780
|
startBufferEvery = startBufferEvery ?? bufferSize;
|
|
777
|
-
return
|
|
781
|
+
return new Observable((subscriber, environment) => {
|
|
778
782
|
let buffers = [];
|
|
779
783
|
let count = 0;
|
|
780
|
-
|
|
784
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
781
785
|
next: value => {
|
|
782
786
|
let toEmit = null;
|
|
783
787
|
if (count++ % startBufferEvery === 0) {
|
|
@@ -802,11 +806,12 @@ export function bufferCount(bufferSize, startBufferEvery) {
|
|
|
802
806
|
subscriber.next(buffer);
|
|
803
807
|
}
|
|
804
808
|
subscriber.complete();
|
|
809
|
+
},
|
|
810
|
+
finalize: () => {
|
|
811
|
+
buffers = null;
|
|
805
812
|
}
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
}));
|
|
809
|
-
})(fa);
|
|
813
|
+
})(subscriber));
|
|
814
|
+
});
|
|
810
815
|
};
|
|
811
816
|
}
|
|
812
817
|
/**
|
|
@@ -820,7 +825,7 @@ export function bufferTime(config) {
|
|
|
820
825
|
maxBufferSize = Infinity,
|
|
821
826
|
scheduler = tsplus_module_5.asyncScheduler
|
|
822
827
|
} = config;
|
|
823
|
-
return
|
|
828
|
+
return new Observable((subscriber, environment) => {
|
|
824
829
|
let bufferRecords = [];
|
|
825
830
|
let restartOnEmit = true;
|
|
826
831
|
const emit = record => {
|
|
@@ -848,10 +853,10 @@ export function bufferTime(config) {
|
|
|
848
853
|
};
|
|
849
854
|
bufferCreationInterval !== null && bufferCreationInterval >= 0 ? subscriber.add(scheduler.schedule(function () {
|
|
850
855
|
startBuffer();
|
|
851
|
-
!this.
|
|
856
|
+
!this._closed && subscriber.add(this.schedule(null, bufferCreationInterval));
|
|
852
857
|
}, bufferCreationInterval)) : restartOnEmit = true;
|
|
853
858
|
startBuffer();
|
|
854
|
-
const bufferTimeSubscriber = tsplus_module_8.
|
|
859
|
+
const bufferTimeSubscriber = tsplus_module_8.operate_({
|
|
855
860
|
next: value => {
|
|
856
861
|
const recordsCopy = bufferRecords.slice();
|
|
857
862
|
for (const record of recordsCopy) {
|
|
@@ -869,10 +874,13 @@ export function bufferTime(config) {
|
|
|
869
874
|
bufferTimeSubscriber?.unsubscribe();
|
|
870
875
|
subscriber.complete();
|
|
871
876
|
subscriber.unsubscribe();
|
|
877
|
+
},
|
|
878
|
+
finalize: () => {
|
|
879
|
+
bufferRecords = null;
|
|
872
880
|
}
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
})
|
|
881
|
+
})(subscriber);
|
|
882
|
+
return fa.provideEnvironment(environment).subscribe(bufferTimeSubscriber);
|
|
883
|
+
});
|
|
876
884
|
};
|
|
877
885
|
}
|
|
878
886
|
/**
|
|
@@ -880,7 +888,7 @@ export function bufferTime(config) {
|
|
|
880
888
|
*/
|
|
881
889
|
export function bufferToggle(openings, closingSelector) {
|
|
882
890
|
return fa => {
|
|
883
|
-
return
|
|
891
|
+
return new Observable((subscriber, environment) => {
|
|
884
892
|
const buffers = [];
|
|
885
893
|
from_1(openings).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
886
894
|
next: openValue => {
|
|
@@ -899,7 +907,7 @@ export function bufferToggle(openings, closingSelector) {
|
|
|
899
907
|
},
|
|
900
908
|
complete: tsplus_module_2.noop
|
|
901
909
|
}));
|
|
902
|
-
|
|
910
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
903
911
|
next: value => {
|
|
904
912
|
for (const buffer of buffers) {
|
|
905
913
|
buffer.push(value);
|
|
@@ -911,8 +919,8 @@ export function bufferToggle(openings, closingSelector) {
|
|
|
911
919
|
}
|
|
912
920
|
subscriber.complete();
|
|
913
921
|
}
|
|
914
|
-
}));
|
|
915
|
-
})
|
|
922
|
+
})(subscriber));
|
|
923
|
+
});
|
|
916
924
|
};
|
|
917
925
|
}
|
|
918
926
|
/**
|
|
@@ -920,7 +928,7 @@ export function bufferToggle(openings, closingSelector) {
|
|
|
920
928
|
*/
|
|
921
929
|
export function bufferWhen(closingSelector) {
|
|
922
930
|
return fa => {
|
|
923
|
-
return
|
|
931
|
+
return new Observable((subscriber, environment) => {
|
|
924
932
|
let buffer = null;
|
|
925
933
|
let closingSubscriber = null;
|
|
926
934
|
const openBuffer = () => {
|
|
@@ -934,14 +942,15 @@ export function bufferWhen(closingSelector) {
|
|
|
934
942
|
}));
|
|
935
943
|
};
|
|
936
944
|
openBuffer();
|
|
937
|
-
|
|
945
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
938
946
|
next: value => buffer?.push(value),
|
|
939
947
|
complete: () => {
|
|
940
948
|
buffer && subscriber.next(buffer);
|
|
941
949
|
subscriber.complete();
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
|
|
950
|
+
},
|
|
951
|
+
finalize: () => buffer = closingSubscriber = null
|
|
952
|
+
})(subscriber));
|
|
953
|
+
});
|
|
945
954
|
};
|
|
946
955
|
}
|
|
947
956
|
/**
|
|
@@ -949,13 +958,13 @@ export function bufferWhen(closingSelector) {
|
|
|
949
958
|
*/
|
|
950
959
|
function catchAllCause_1(f) {
|
|
951
960
|
return self => {
|
|
952
|
-
return
|
|
961
|
+
return new Observable((subscriber, environment) => {
|
|
953
962
|
let innerSub = null;
|
|
954
963
|
let syncUnsub = false;
|
|
955
964
|
let handledResult;
|
|
956
|
-
innerSub =
|
|
965
|
+
innerSub = self.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
957
966
|
error: cause => {
|
|
958
|
-
handledResult = from_1(f(cause, catchAllCause_1(f)(
|
|
967
|
+
handledResult = from_1(f(cause, catchAllCause_1(f)(self)));
|
|
959
968
|
if (innerSub) {
|
|
960
969
|
innerSub.unsubscribe();
|
|
961
970
|
innerSub = null;
|
|
@@ -964,13 +973,13 @@ function catchAllCause_1(f) {
|
|
|
964
973
|
syncUnsub = true;
|
|
965
974
|
}
|
|
966
975
|
}
|
|
967
|
-
}));
|
|
976
|
+
})(subscriber));
|
|
968
977
|
if (syncUnsub) {
|
|
969
978
|
innerSub.unsubscribe();
|
|
970
979
|
innerSub = null;
|
|
971
980
|
handledResult.provideEnvironment(environment).subscribe(subscriber);
|
|
972
981
|
}
|
|
973
|
-
})
|
|
982
|
+
});
|
|
974
983
|
};
|
|
975
984
|
}
|
|
976
985
|
/**
|
|
@@ -984,9 +993,9 @@ function concatAll_1(ffa) {
|
|
|
984
993
|
*/
|
|
985
994
|
function concat_1(...sources) {
|
|
986
995
|
return fa => {
|
|
987
|
-
return
|
|
988
|
-
concatAll_1(fromArrayLike([
|
|
989
|
-
})
|
|
996
|
+
return new Observable((subscriber, environment) => {
|
|
997
|
+
return concatAll_1(fromArrayLike([fa, ...sources])).provideEnvironment(environment).subscribe(subscriber);
|
|
998
|
+
});
|
|
990
999
|
};
|
|
991
1000
|
}
|
|
992
1001
|
/**
|
|
@@ -1023,11 +1032,11 @@ export function combineLatestAll(fa) {
|
|
|
1023
1032
|
function zipLatest_1(...sources) {
|
|
1024
1033
|
return self => {
|
|
1025
1034
|
if (!sources.length) {
|
|
1026
|
-
return from_1(self)
|
|
1035
|
+
return from_1(self);
|
|
1027
1036
|
}
|
|
1028
|
-
return
|
|
1029
|
-
combineLatestInternal(subscriber, environment, [
|
|
1030
|
-
})
|
|
1037
|
+
return new Observable((subscriber, environment) => {
|
|
1038
|
+
return combineLatestInternal(subscriber, environment, [self, ...sources]);
|
|
1039
|
+
});
|
|
1031
1040
|
};
|
|
1032
1041
|
}
|
|
1033
1042
|
/**
|
|
@@ -1043,8 +1052,8 @@ export function zipWithLatest(that, f) {
|
|
|
1043
1052
|
*/
|
|
1044
1053
|
export function debounceWith(durationSelector) {
|
|
1045
1054
|
return fa => {
|
|
1046
|
-
return
|
|
1047
|
-
let lastValue = tsplus_module_17.nothing(fileName_1 + ":
|
|
1055
|
+
return new Observable((subscriber, environment) => {
|
|
1056
|
+
let lastValue = tsplus_module_17.nothing(fileName_1 + ":1288:40");
|
|
1048
1057
|
let durationSubscriber = null;
|
|
1049
1058
|
const emit = () => {
|
|
1050
1059
|
durationSubscriber?.unsubscribe();
|
|
@@ -1053,28 +1062,29 @@ export function debounceWith(durationSelector) {
|
|
|
1053
1062
|
const {
|
|
1054
1063
|
value
|
|
1055
1064
|
} = lastValue;
|
|
1056
|
-
lastValue = tsplus_module_17.nothing(fileName_1 + ":
|
|
1065
|
+
lastValue = tsplus_module_17.nothing(fileName_1 + ":1295:36");
|
|
1057
1066
|
subscriber.next(value);
|
|
1058
1067
|
}
|
|
1059
1068
|
};
|
|
1060
|
-
|
|
1069
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1061
1070
|
next: value => {
|
|
1062
1071
|
durationSubscriber?.unsubscribe();
|
|
1063
|
-
lastValue = tsplus_module_17.just(value, fileName_1 + ":
|
|
1064
|
-
durationSubscriber = tsplus_module_8.
|
|
1072
|
+
lastValue = tsplus_module_17.just(value, fileName_1 + ":1303:38");
|
|
1073
|
+
durationSubscriber = tsplus_module_8.operate_({
|
|
1065
1074
|
next: emit,
|
|
1066
1075
|
complete: tsplus_module_2.noop
|
|
1067
|
-
});
|
|
1076
|
+
})(subscriber);
|
|
1068
1077
|
from_1(durationSelector(value)).provideEnvironment(environment).subscribe(durationSubscriber);
|
|
1069
1078
|
},
|
|
1070
1079
|
complete: () => {
|
|
1071
1080
|
emit();
|
|
1072
1081
|
subscriber.complete();
|
|
1082
|
+
},
|
|
1083
|
+
finalize: () => {
|
|
1084
|
+
lastValue = durationSubscriber = null;
|
|
1073
1085
|
}
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
}));
|
|
1077
|
-
})(fa);
|
|
1086
|
+
})(subscriber));
|
|
1087
|
+
});
|
|
1078
1088
|
};
|
|
1079
1089
|
}
|
|
1080
1090
|
/**
|
|
@@ -1082,7 +1092,7 @@ export function debounceWith(durationSelector) {
|
|
|
1082
1092
|
*/
|
|
1083
1093
|
export function debounce(dueTime, scheduler = tsplus_module_5.asyncScheduler) {
|
|
1084
1094
|
return fa => {
|
|
1085
|
-
return
|
|
1095
|
+
return new Observable((subscriber, environment) => {
|
|
1086
1096
|
let activeTask = null;
|
|
1087
1097
|
let lastValue = null;
|
|
1088
1098
|
let lastTime = null;
|
|
@@ -1105,7 +1115,7 @@ export function debounce(dueTime, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
1105
1115
|
}
|
|
1106
1116
|
emit();
|
|
1107
1117
|
}
|
|
1108
|
-
|
|
1118
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1109
1119
|
next: value => {
|
|
1110
1120
|
lastValue = value;
|
|
1111
1121
|
lastTime = scheduler.now();
|
|
@@ -1117,27 +1127,28 @@ export function debounce(dueTime, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
1117
1127
|
complete: () => {
|
|
1118
1128
|
emit();
|
|
1119
1129
|
subscriber.complete();
|
|
1130
|
+
},
|
|
1131
|
+
finalize: () => {
|
|
1132
|
+
lastValue = activeTask = null;
|
|
1120
1133
|
}
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
}));
|
|
1124
|
-
})(fa);
|
|
1134
|
+
})(subscriber));
|
|
1135
|
+
});
|
|
1125
1136
|
};
|
|
1126
1137
|
}
|
|
1127
1138
|
/**
|
|
1128
1139
|
* @tsplus getter fncts.observable.Observable either
|
|
1129
1140
|
*/
|
|
1130
1141
|
export function either(fa) {
|
|
1131
|
-
return
|
|
1132
|
-
|
|
1142
|
+
return new Observable((subscriber, environment) => {
|
|
1143
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1133
1144
|
next: value => {
|
|
1134
|
-
subscriber.next(tsplus_module_19.right(value, fileName_1 + ":
|
|
1145
|
+
subscriber.next(tsplus_module_19.right(value, fileName_1 + ":1379:39"));
|
|
1135
1146
|
},
|
|
1136
1147
|
error: error => {
|
|
1137
|
-
tsplus_module_14.match(e => subscriber.next(tsplus_module_19.left(e, fileName_1 + ":
|
|
1148
|
+
tsplus_module_14.match(e => subscriber.next(tsplus_module_19.left(e, fileName_1 + ":1383:47")), cause => subscriber.error(cause))(tsplus_module_1.failureOrCause(error));
|
|
1138
1149
|
}
|
|
1139
|
-
}));
|
|
1140
|
-
})
|
|
1150
|
+
})(subscriber));
|
|
1151
|
+
});
|
|
1141
1152
|
}
|
|
1142
1153
|
/**
|
|
1143
1154
|
* @tsplus pipeable fncts.observable.Observable delayWithIndex
|
|
@@ -1168,39 +1179,39 @@ export function delay(due, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
1168
1179
|
* @tsplus getter fncts.observable.Observable dematerialize
|
|
1169
1180
|
*/
|
|
1170
1181
|
export function dematerialize(fa) {
|
|
1171
|
-
return
|
|
1172
|
-
|
|
1182
|
+
return new Observable((subscriber, environment) => {
|
|
1183
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1173
1184
|
next: notification => tsplus_module_20.observe(subscriber)(notification)
|
|
1174
|
-
}));
|
|
1175
|
-
})
|
|
1185
|
+
})(subscriber));
|
|
1186
|
+
});
|
|
1176
1187
|
}
|
|
1177
1188
|
/**
|
|
1178
1189
|
* @tsplus pipeable fncts.observable.Observable ensuring
|
|
1179
1190
|
*/
|
|
1180
1191
|
export function ensuring(finalizer) {
|
|
1181
1192
|
return fa => {
|
|
1182
|
-
return
|
|
1183
|
-
source.provideEnvironment(environment).subscribe(subscriber);
|
|
1193
|
+
return new Observable((subscriber, environment) => {
|
|
1184
1194
|
subscriber.add(finalizer);
|
|
1185
|
-
|
|
1195
|
+
return fa.provideEnvironment(environment).subscribe(subscriber);
|
|
1196
|
+
});
|
|
1186
1197
|
};
|
|
1187
1198
|
}
|
|
1188
1199
|
/**
|
|
1189
1200
|
* @tsplus getter fncts.observable.Observable exhaustAll
|
|
1190
1201
|
*/
|
|
1191
1202
|
export function exhaustAll(ffa) {
|
|
1192
|
-
return
|
|
1203
|
+
return new Observable((subscriber, environment) => {
|
|
1193
1204
|
let isComplete = false;
|
|
1194
1205
|
let innerSub = null;
|
|
1195
|
-
|
|
1206
|
+
return ffa.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1196
1207
|
next: inner => {
|
|
1197
1208
|
if (!innerSub) {
|
|
1198
|
-
innerSub = from_1(inner).provideEnvironment(environment).subscribe(tsplus_module_8.
|
|
1209
|
+
innerSub = from_1(inner).provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1199
1210
|
complete: () => {
|
|
1200
1211
|
innerSub = null;
|
|
1201
1212
|
isComplete && subscriber.complete();
|
|
1202
1213
|
}
|
|
1203
|
-
}));
|
|
1214
|
+
})(subscriber));
|
|
1204
1215
|
}
|
|
1205
1216
|
},
|
|
1206
1217
|
complete: () => {
|
|
@@ -1208,26 +1219,26 @@ export function exhaustAll(ffa) {
|
|
|
1208
1219
|
!innerSub && subscriber.complete();
|
|
1209
1220
|
}
|
|
1210
1221
|
}));
|
|
1211
|
-
})
|
|
1222
|
+
});
|
|
1212
1223
|
}
|
|
1213
1224
|
/**
|
|
1214
1225
|
* @tsplus pipeable fncts.observable.Observable exhaustMapWithIndex
|
|
1215
1226
|
*/
|
|
1216
1227
|
function exhaustMapWithIndex_1(f) {
|
|
1217
1228
|
return self => {
|
|
1218
|
-
return
|
|
1229
|
+
return new Observable((subscriber, environment) => {
|
|
1219
1230
|
let index = 0;
|
|
1220
1231
|
let innerSub = null;
|
|
1221
1232
|
let isComplete = false;
|
|
1222
|
-
|
|
1233
|
+
self.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1223
1234
|
next: outerValue => {
|
|
1224
1235
|
if (!innerSub) {
|
|
1225
|
-
innerSub = tsplus_module_8.
|
|
1236
|
+
innerSub = tsplus_module_8.operate_({
|
|
1226
1237
|
complete: () => {
|
|
1227
1238
|
innerSub = null;
|
|
1228
1239
|
isComplete && subscriber.complete();
|
|
1229
1240
|
}
|
|
1230
|
-
});
|
|
1241
|
+
})(subscriber);
|
|
1231
1242
|
from_1(f(index++, outerValue)).provideEnvironment(environment).subscribe(innerSub);
|
|
1232
1243
|
}
|
|
1233
1244
|
},
|
|
@@ -1235,8 +1246,8 @@ function exhaustMapWithIndex_1(f) {
|
|
|
1235
1246
|
isComplete = true;
|
|
1236
1247
|
!innerSub && subscriber.complete();
|
|
1237
1248
|
}
|
|
1238
|
-
}));
|
|
1239
|
-
})
|
|
1249
|
+
})(subscriber));
|
|
1250
|
+
});
|
|
1240
1251
|
};
|
|
1241
1252
|
}
|
|
1242
1253
|
/**
|
|
@@ -1253,7 +1264,9 @@ export function exhaustMap(f) {
|
|
|
1253
1264
|
function expandWithIndex_1(f, concurrent = Infinity) {
|
|
1254
1265
|
return fa => {
|
|
1255
1266
|
concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
|
|
1256
|
-
return
|
|
1267
|
+
return new Observable((subscriber, environment) => {
|
|
1268
|
+
return mergeInternal(fa, subscriber, environment, f, concurrent, undefined, true);
|
|
1269
|
+
});
|
|
1257
1270
|
};
|
|
1258
1271
|
}
|
|
1259
1272
|
/**
|
|
@@ -1266,7 +1279,7 @@ export function expand(f, concurrent = Infinity) {
|
|
|
1266
1279
|
}
|
|
1267
1280
|
function findWithIndex_1(predicate) {
|
|
1268
1281
|
return fa => {
|
|
1269
|
-
return
|
|
1282
|
+
return new Observable(findInternal(fa, predicate, "value"));
|
|
1270
1283
|
};
|
|
1271
1284
|
}
|
|
1272
1285
|
export function find(predicate) {
|
|
@@ -1276,7 +1289,7 @@ export function find(predicate) {
|
|
|
1276
1289
|
}
|
|
1277
1290
|
function findIndexWithIndex_1(predicate) {
|
|
1278
1291
|
return fa => {
|
|
1279
|
-
return
|
|
1292
|
+
return new Observable(findInternal(fa, predicate, "index"));
|
|
1280
1293
|
};
|
|
1281
1294
|
}
|
|
1282
1295
|
export function findIndex(predicate) {
|
|
@@ -1289,7 +1302,7 @@ export function forkJoin(...args) {
|
|
|
1289
1302
|
args: sources,
|
|
1290
1303
|
keys
|
|
1291
1304
|
} = arrayOrObject(args);
|
|
1292
|
-
return new Observable(s => {
|
|
1305
|
+
return new Observable((s, environment) => {
|
|
1293
1306
|
const length = sources.length;
|
|
1294
1307
|
if (!length) {
|
|
1295
1308
|
s.complete();
|
|
@@ -1300,7 +1313,7 @@ export function forkJoin(...args) {
|
|
|
1300
1313
|
let remainingEmissions = length;
|
|
1301
1314
|
for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) {
|
|
1302
1315
|
let hasValue = false;
|
|
1303
|
-
from_1(sources[sourceIndex]).subscribe(tsplus_module_8.
|
|
1316
|
+
from_1(sources[sourceIndex]).provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1304
1317
|
next: value => {
|
|
1305
1318
|
if (!hasValue) {
|
|
1306
1319
|
hasValue = true;
|
|
@@ -1320,7 +1333,7 @@ export function forkJoin(...args) {
|
|
|
1320
1333
|
s.complete();
|
|
1321
1334
|
}
|
|
1322
1335
|
}
|
|
1323
|
-
}));
|
|
1336
|
+
})(s));
|
|
1324
1337
|
}
|
|
1325
1338
|
});
|
|
1326
1339
|
}
|
|
@@ -1328,18 +1341,18 @@ export function forkJoin(...args) {
|
|
|
1328
1341
|
* @tsplus getter fncts.observable.Observable ignore
|
|
1329
1342
|
*/
|
|
1330
1343
|
export function ignore(fa) {
|
|
1331
|
-
return
|
|
1332
|
-
|
|
1344
|
+
return new Observable((subscriber, environment) => {
|
|
1345
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1333
1346
|
next: tsplus_module_2.noop
|
|
1334
|
-
}));
|
|
1335
|
-
})
|
|
1347
|
+
})(subscriber));
|
|
1348
|
+
});
|
|
1336
1349
|
}
|
|
1337
1350
|
/**
|
|
1338
1351
|
* @tsplus getter fncts.observable.Observable isEmpty
|
|
1339
1352
|
*/
|
|
1340
1353
|
export function isEmpty(fa) {
|
|
1341
|
-
return
|
|
1342
|
-
|
|
1354
|
+
return new Observable((subscriber, environment) => {
|
|
1355
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1343
1356
|
next: () => {
|
|
1344
1357
|
subscriber.next(false);
|
|
1345
1358
|
subscriber.complete();
|
|
@@ -1348,15 +1361,15 @@ export function isEmpty(fa) {
|
|
|
1348
1361
|
subscriber.next(true);
|
|
1349
1362
|
subscriber.complete();
|
|
1350
1363
|
}
|
|
1351
|
-
}));
|
|
1352
|
-
})
|
|
1364
|
+
})(subscriber));
|
|
1365
|
+
});
|
|
1353
1366
|
}
|
|
1354
1367
|
/**
|
|
1355
1368
|
* @tsplus getter fncts.observable.Observable materialize
|
|
1356
1369
|
*/
|
|
1357
1370
|
export function materialize(fa) {
|
|
1358
|
-
return
|
|
1359
|
-
|
|
1371
|
+
return new Observable((subscriber, environment) => {
|
|
1372
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1360
1373
|
next: value => {
|
|
1361
1374
|
subscriber.next(tsplus_module_20.next(value));
|
|
1362
1375
|
},
|
|
@@ -1366,8 +1379,8 @@ export function materialize(fa) {
|
|
|
1366
1379
|
complete: () => {
|
|
1367
1380
|
subscriber.next(tsplus_module_20.complete());
|
|
1368
1381
|
}
|
|
1369
|
-
}));
|
|
1370
|
-
})
|
|
1382
|
+
})(subscriber));
|
|
1383
|
+
});
|
|
1371
1384
|
}
|
|
1372
1385
|
/**
|
|
1373
1386
|
* @tsplus pipeable fncts.observable.Observable mergeAll
|
|
@@ -1382,12 +1395,12 @@ function mergeAll_1(concurrent = Infinity) {
|
|
|
1382
1395
|
*/
|
|
1383
1396
|
function mergeScanWithIndex_1(initial, f, concurrent = Infinity) {
|
|
1384
1397
|
return fa => {
|
|
1385
|
-
return
|
|
1398
|
+
return new Observable((subscriber, environment) => {
|
|
1386
1399
|
let state = initial;
|
|
1387
|
-
return mergeInternal(
|
|
1400
|
+
return mergeInternal(fa, subscriber, environment, (index, value) => f(index, state, value), concurrent, value => {
|
|
1388
1401
|
state = value;
|
|
1389
1402
|
}, false, undefined, () => state = null);
|
|
1390
|
-
})
|
|
1403
|
+
});
|
|
1391
1404
|
};
|
|
1392
1405
|
}
|
|
1393
1406
|
/**
|
|
@@ -1399,10 +1412,10 @@ export function mergeScan(initial, f, concurrent = Infinity) {
|
|
|
1399
1412
|
};
|
|
1400
1413
|
}
|
|
1401
1414
|
export function onErrorResumeNext(fa, ...sources) {
|
|
1402
|
-
return
|
|
1403
|
-
const remaining = [
|
|
1415
|
+
return new Observable((subscriber, environment) => {
|
|
1416
|
+
const remaining = [fa, ...sources];
|
|
1404
1417
|
const subscribeNext = () => {
|
|
1405
|
-
if (!subscriber.
|
|
1418
|
+
if (!subscriber._closed) {
|
|
1406
1419
|
if (remaining.length > 0) {
|
|
1407
1420
|
let nextSource;
|
|
1408
1421
|
try {
|
|
@@ -1411,10 +1424,10 @@ export function onErrorResumeNext(fa, ...sources) {
|
|
|
1411
1424
|
subscribeNext();
|
|
1412
1425
|
return;
|
|
1413
1426
|
}
|
|
1414
|
-
const innerSub = tsplus_module_8.
|
|
1427
|
+
const innerSub = tsplus_module_8.operate_({
|
|
1415
1428
|
error: tsplus_module_2.noop,
|
|
1416
1429
|
complete: tsplus_module_2.noop
|
|
1417
|
-
});
|
|
1430
|
+
})(subscriber);
|
|
1418
1431
|
subscriber.add(nextSource.provideEnvironment(environment).subscribe(innerSub));
|
|
1419
1432
|
innerSub.add(subscribeNext);
|
|
1420
1433
|
} else {
|
|
@@ -1423,16 +1436,16 @@ export function onErrorResumeNext(fa, ...sources) {
|
|
|
1423
1436
|
}
|
|
1424
1437
|
};
|
|
1425
1438
|
subscribeNext();
|
|
1426
|
-
})
|
|
1439
|
+
});
|
|
1427
1440
|
}
|
|
1428
1441
|
/**
|
|
1429
1442
|
* @tsplus pipeable fncts.observable.Observable onEmpty
|
|
1430
1443
|
*/
|
|
1431
1444
|
function onEmpty_1(f) {
|
|
1432
1445
|
return fa => {
|
|
1433
|
-
return
|
|
1446
|
+
return new Observable((subscriber, environment) => {
|
|
1434
1447
|
let hasValue = false;
|
|
1435
|
-
|
|
1448
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1436
1449
|
next: value => {
|
|
1437
1450
|
hasValue = true;
|
|
1438
1451
|
subscriber.next(value);
|
|
@@ -1443,8 +1456,8 @@ function onEmpty_1(f) {
|
|
|
1443
1456
|
}
|
|
1444
1457
|
subscriber.complete();
|
|
1445
1458
|
}
|
|
1446
|
-
}));
|
|
1447
|
-
})
|
|
1459
|
+
})(subscriber));
|
|
1460
|
+
});
|
|
1448
1461
|
};
|
|
1449
1462
|
}
|
|
1450
1463
|
/**
|
|
@@ -1452,12 +1465,12 @@ function onEmpty_1(f) {
|
|
|
1452
1465
|
*/
|
|
1453
1466
|
export function repeat(count = Infinity) {
|
|
1454
1467
|
return fa => {
|
|
1455
|
-
return count <= 0 ? empty_1() :
|
|
1468
|
+
return count <= 0 ? empty_1() : new Observable((subscriber, environment) => {
|
|
1456
1469
|
let repeats = 0;
|
|
1457
1470
|
let innerSub;
|
|
1458
1471
|
const loop = () => {
|
|
1459
1472
|
let syncUnsub = false;
|
|
1460
|
-
innerSub =
|
|
1473
|
+
innerSub = fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1461
1474
|
complete: () => {
|
|
1462
1475
|
if (++repeats < count) {
|
|
1463
1476
|
if (innerSub) {
|
|
@@ -1471,7 +1484,7 @@ export function repeat(count = Infinity) {
|
|
|
1471
1484
|
subscriber.complete;
|
|
1472
1485
|
}
|
|
1473
1486
|
}
|
|
1474
|
-
}));
|
|
1487
|
+
})(subscriber));
|
|
1475
1488
|
if (syncUnsub) {
|
|
1476
1489
|
innerSub.unsubscribe();
|
|
1477
1490
|
innerSub = null;
|
|
@@ -1479,7 +1492,7 @@ export function repeat(count = Infinity) {
|
|
|
1479
1492
|
}
|
|
1480
1493
|
};
|
|
1481
1494
|
loop();
|
|
1482
|
-
})
|
|
1495
|
+
});
|
|
1483
1496
|
};
|
|
1484
1497
|
}
|
|
1485
1498
|
export function retry(configOrCount = Infinity) {
|
|
@@ -1496,12 +1509,12 @@ export function retry(configOrCount = Infinity) {
|
|
|
1496
1509
|
count,
|
|
1497
1510
|
resetOnSuccess = false
|
|
1498
1511
|
} = config;
|
|
1499
|
-
return count <= 0 ? fa :
|
|
1512
|
+
return count <= 0 ? fa : new Observable((subscriber, environment) => {
|
|
1500
1513
|
let retries = 0;
|
|
1501
1514
|
let innerSub;
|
|
1502
1515
|
const loop = () => {
|
|
1503
1516
|
let syncUnsub = false;
|
|
1504
|
-
innerSub =
|
|
1517
|
+
innerSub = fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1505
1518
|
next: value => {
|
|
1506
1519
|
if (resetOnSuccess) {
|
|
1507
1520
|
retries = 0;
|
|
@@ -1521,7 +1534,7 @@ export function retry(configOrCount = Infinity) {
|
|
|
1521
1534
|
subscriber.error(err);
|
|
1522
1535
|
}
|
|
1523
1536
|
}
|
|
1524
|
-
}));
|
|
1537
|
+
})(subscriber));
|
|
1525
1538
|
if (syncUnsub) {
|
|
1526
1539
|
innerSub.unsubscribe();
|
|
1527
1540
|
innerSub = null;
|
|
@@ -1529,7 +1542,7 @@ export function retry(configOrCount = Infinity) {
|
|
|
1529
1542
|
}
|
|
1530
1543
|
};
|
|
1531
1544
|
loop();
|
|
1532
|
-
})
|
|
1545
|
+
});
|
|
1533
1546
|
};
|
|
1534
1547
|
}
|
|
1535
1548
|
/**
|
|
@@ -1537,15 +1550,15 @@ export function retry(configOrCount = Infinity) {
|
|
|
1537
1550
|
*/
|
|
1538
1551
|
function sample_1(notifier) {
|
|
1539
1552
|
return fa => {
|
|
1540
|
-
return
|
|
1553
|
+
return new Observable((subscriber, environment) => {
|
|
1541
1554
|
let hasValue = false;
|
|
1542
1555
|
let lastValue = null;
|
|
1543
|
-
|
|
1556
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1544
1557
|
next: value => {
|
|
1545
1558
|
hasValue = true;
|
|
1546
1559
|
lastValue = value;
|
|
1547
1560
|
}
|
|
1548
|
-
}));
|
|
1561
|
+
})(subscriber));
|
|
1549
1562
|
const emit = () => {
|
|
1550
1563
|
if (hasValue) {
|
|
1551
1564
|
hasValue = false;
|
|
@@ -1554,11 +1567,11 @@ function sample_1(notifier) {
|
|
|
1554
1567
|
subscriber.next(value);
|
|
1555
1568
|
}
|
|
1556
1569
|
};
|
|
1557
|
-
notifier.provideEnvironment(environment).subscribe(tsplus_module_8.
|
|
1570
|
+
notifier.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1558
1571
|
next: emit,
|
|
1559
1572
|
complete: tsplus_module_2.noop
|
|
1560
|
-
}));
|
|
1561
|
-
})
|
|
1573
|
+
})(subscriber));
|
|
1574
|
+
});
|
|
1562
1575
|
};
|
|
1563
1576
|
}
|
|
1564
1577
|
/**
|
|
@@ -1574,7 +1587,7 @@ export function sampleTime(period, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
1574
1587
|
*/
|
|
1575
1588
|
function scanLeftWithIndex_1(initial, f) {
|
|
1576
1589
|
return fa => {
|
|
1577
|
-
return
|
|
1590
|
+
return new Observable((subscriber, environment) => scanInternal(fa, subscriber, environment, f, initial, true, true));
|
|
1578
1591
|
};
|
|
1579
1592
|
}
|
|
1580
1593
|
/**
|
|
@@ -1588,7 +1601,7 @@ export function scanLeft(initial, f) {
|
|
|
1588
1601
|
/**
|
|
1589
1602
|
* @tsplus static fncts.observable.ObservableOps service
|
|
1590
1603
|
*/
|
|
1591
|
-
export function service(
|
|
1604
|
+
export function service(/** @tsplus auto */tag) {
|
|
1592
1605
|
return serviceWithObservable_1(service => of_1(service), tag);
|
|
1593
1606
|
}
|
|
1594
1607
|
/**
|
|
@@ -1616,10 +1629,10 @@ export function skip(count) {
|
|
|
1616
1629
|
*/
|
|
1617
1630
|
export function skipLast(skipCount) {
|
|
1618
1631
|
return fa => {
|
|
1619
|
-
return skipCount <= 0 ? fa :
|
|
1632
|
+
return skipCount <= 0 ? fa : new Observable((subscriber, environment) => {
|
|
1620
1633
|
let ring = new Array(skipCount);
|
|
1621
1634
|
let seen = 0;
|
|
1622
|
-
|
|
1635
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1623
1636
|
next: value => {
|
|
1624
1637
|
const valueIndex = seen++;
|
|
1625
1638
|
if (valueIndex < skipCount) {
|
|
@@ -1631,11 +1644,11 @@ export function skipLast(skipCount) {
|
|
|
1631
1644
|
subscriber.next(oldValue);
|
|
1632
1645
|
}
|
|
1633
1646
|
}
|
|
1634
|
-
}));
|
|
1647
|
+
})(subscriber));
|
|
1635
1648
|
return () => {
|
|
1636
1649
|
ring = null;
|
|
1637
1650
|
};
|
|
1638
|
-
})
|
|
1651
|
+
});
|
|
1639
1652
|
};
|
|
1640
1653
|
}
|
|
1641
1654
|
/**
|
|
@@ -1643,20 +1656,20 @@ export function skipLast(skipCount) {
|
|
|
1643
1656
|
*/
|
|
1644
1657
|
export function skipUntil(notifier) {
|
|
1645
1658
|
return fa => {
|
|
1646
|
-
return
|
|
1659
|
+
return new Observable((subscriber, environment) => {
|
|
1647
1660
|
let taking = false;
|
|
1648
|
-
const skipSubscriber = tsplus_module_8.
|
|
1661
|
+
const skipSubscriber = tsplus_module_8.operate_({
|
|
1649
1662
|
next: () => {
|
|
1650
1663
|
skipSubscriber?.unsubscribe();
|
|
1651
1664
|
taking = true;
|
|
1652
1665
|
},
|
|
1653
1666
|
complete: tsplus_module_2.noop
|
|
1654
|
-
});
|
|
1667
|
+
})(subscriber);
|
|
1655
1668
|
from_1(notifier).provideEnvironment(environment).subscribe(skipSubscriber);
|
|
1656
|
-
|
|
1669
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1657
1670
|
next: value => taking && subscriber.next(value)
|
|
1658
|
-
}));
|
|
1659
|
-
})
|
|
1671
|
+
})(subscriber));
|
|
1672
|
+
});
|
|
1660
1673
|
};
|
|
1661
1674
|
}
|
|
1662
1675
|
/**
|
|
@@ -1664,13 +1677,13 @@ export function skipUntil(notifier) {
|
|
|
1664
1677
|
*/
|
|
1665
1678
|
export function skipWhile(predicate) {
|
|
1666
1679
|
return fa => {
|
|
1667
|
-
return
|
|
1680
|
+
return new Observable((subscriber, environment) => {
|
|
1668
1681
|
let taking = false;
|
|
1669
1682
|
let index = 0;
|
|
1670
|
-
|
|
1683
|
+
return fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1671
1684
|
next: value => (taking || (taking = !predicate(index++, value))) && subscriber.next(value)
|
|
1672
|
-
}));
|
|
1673
|
-
})
|
|
1685
|
+
})(subscriber));
|
|
1686
|
+
});
|
|
1674
1687
|
};
|
|
1675
1688
|
}
|
|
1676
1689
|
/**
|
|
@@ -1678,10 +1691,10 @@ export function skipWhile(predicate) {
|
|
|
1678
1691
|
*/
|
|
1679
1692
|
export function startWith(...values) {
|
|
1680
1693
|
return fa => {
|
|
1681
|
-
return
|
|
1694
|
+
return new Observable((subscriber, environment) => {
|
|
1682
1695
|
// @ts-expect-error
|
|
1683
|
-
concat_1(values)(
|
|
1684
|
-
})
|
|
1696
|
+
return concat_1(values)(fa).provideEnvironment(environment).subscribe(subscriber);
|
|
1697
|
+
});
|
|
1685
1698
|
};
|
|
1686
1699
|
}
|
|
1687
1700
|
/**
|
|
@@ -1689,9 +1702,9 @@ export function startWith(...values) {
|
|
|
1689
1702
|
*/
|
|
1690
1703
|
export function subscribeOn(scheduler, delay = 0) {
|
|
1691
1704
|
return fa => {
|
|
1692
|
-
return
|
|
1693
|
-
subscriber.add(scheduler.schedule(() =>
|
|
1694
|
-
})
|
|
1705
|
+
return new Observable((subscriber, environment) => {
|
|
1706
|
+
subscriber.add(scheduler.schedule(() => fa.provideEnvironment(environment).subscribe(subscriber), delay));
|
|
1707
|
+
});
|
|
1695
1708
|
};
|
|
1696
1709
|
}
|
|
1697
1710
|
/**
|
|
@@ -1705,28 +1718,29 @@ export function switchAll(ffa) {
|
|
|
1705
1718
|
*/
|
|
1706
1719
|
function switchMapWithIndex_1(f) {
|
|
1707
1720
|
return fa => {
|
|
1708
|
-
return
|
|
1721
|
+
return new Observable((destination, environment) => {
|
|
1709
1722
|
let innerSubscriber = null;
|
|
1710
1723
|
let index = 0;
|
|
1711
1724
|
let isComplete = false;
|
|
1712
|
-
const checkComplete = () => isComplete && !innerSubscriber &&
|
|
1713
|
-
|
|
1725
|
+
const checkComplete = () => isComplete && !innerSubscriber && destination.complete();
|
|
1726
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1714
1727
|
next: value => {
|
|
1715
1728
|
innerSubscriber?.unsubscribe();
|
|
1716
1729
|
const outerIndex = index++;
|
|
1717
|
-
from_1(f(outerIndex, value)).provideEnvironment(environment).subscribe(innerSubscriber = tsplus_module_8.
|
|
1718
|
-
next: innerValue =>
|
|
1730
|
+
from_1(f(outerIndex, value)).provideEnvironment(environment).subscribe(innerSubscriber = tsplus_module_8.operate_({
|
|
1731
|
+
next: innerValue => destination.next(innerValue),
|
|
1719
1732
|
complete: () => {
|
|
1720
1733
|
innerSubscriber = null;
|
|
1721
1734
|
checkComplete();
|
|
1722
1735
|
}
|
|
1723
|
-
}));
|
|
1736
|
+
})(destination));
|
|
1737
|
+
},
|
|
1738
|
+
complete: () => {
|
|
1739
|
+
isComplete = true;
|
|
1740
|
+
checkComplete();
|
|
1724
1741
|
}
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
checkComplete();
|
|
1728
|
-
}));
|
|
1729
|
-
})(fa);
|
|
1742
|
+
})(destination));
|
|
1743
|
+
});
|
|
1730
1744
|
};
|
|
1731
1745
|
}
|
|
1732
1746
|
/**
|
|
@@ -1742,13 +1756,13 @@ function switchMap_1(f) {
|
|
|
1742
1756
|
*/
|
|
1743
1757
|
function switchScanWithIndex_1(initial, f) {
|
|
1744
1758
|
return fa => {
|
|
1745
|
-
return
|
|
1759
|
+
return new Observable((subscriber, environment) => {
|
|
1746
1760
|
let state = initial;
|
|
1747
|
-
switchMapWithIndex_1((index, value) => map_1(b => (state = b, b))(from_1(f(index, state, value))))(
|
|
1761
|
+
switchMapWithIndex_1((index, value) => map_1(b => (state = b, b))(from_1(f(index, state, value))))(fa).provideEnvironment(environment).subscribe(subscriber);
|
|
1748
1762
|
return () => {
|
|
1749
1763
|
state = null;
|
|
1750
1764
|
};
|
|
1751
|
-
})
|
|
1765
|
+
});
|
|
1752
1766
|
};
|
|
1753
1767
|
}
|
|
1754
1768
|
/**
|
|
@@ -1764,9 +1778,9 @@ export function switchScan(initial, f) {
|
|
|
1764
1778
|
*/
|
|
1765
1779
|
function take_1(count) {
|
|
1766
1780
|
return fa => {
|
|
1767
|
-
return count <= 0 ? empty_1() :
|
|
1781
|
+
return count <= 0 ? empty_1() : new Observable((sub, environment) => {
|
|
1768
1782
|
let seen = 0;
|
|
1769
|
-
|
|
1783
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1770
1784
|
next: value => {
|
|
1771
1785
|
if (++seen <= count) {
|
|
1772
1786
|
sub.next(value);
|
|
@@ -1775,8 +1789,8 @@ function take_1(count) {
|
|
|
1775
1789
|
}
|
|
1776
1790
|
}
|
|
1777
1791
|
}
|
|
1778
|
-
}));
|
|
1779
|
-
})
|
|
1792
|
+
})(sub));
|
|
1793
|
+
});
|
|
1780
1794
|
};
|
|
1781
1795
|
}
|
|
1782
1796
|
/**
|
|
@@ -1784,9 +1798,9 @@ function take_1(count) {
|
|
|
1784
1798
|
*/
|
|
1785
1799
|
export function takeLast(count) {
|
|
1786
1800
|
return fa => {
|
|
1787
|
-
return count <= 0 ? empty_1() :
|
|
1801
|
+
return count <= 0 ? empty_1() : new Observable((subscriber, environment) => {
|
|
1788
1802
|
let buffer = [];
|
|
1789
|
-
|
|
1803
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1790
1804
|
next: value => {
|
|
1791
1805
|
buffer.push(value);
|
|
1792
1806
|
count < buffer.length && buffer.shift();
|
|
@@ -1796,11 +1810,12 @@ export function takeLast(count) {
|
|
|
1796
1810
|
subscriber.next(value);
|
|
1797
1811
|
}
|
|
1798
1812
|
subscriber.complete();
|
|
1813
|
+
},
|
|
1814
|
+
finalize: () => {
|
|
1815
|
+
buffer = null;
|
|
1799
1816
|
}
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
}));
|
|
1803
|
-
})(fa);
|
|
1817
|
+
})(subscriber));
|
|
1818
|
+
});
|
|
1804
1819
|
};
|
|
1805
1820
|
}
|
|
1806
1821
|
/**
|
|
@@ -1808,27 +1823,27 @@ export function takeLast(count) {
|
|
|
1808
1823
|
*/
|
|
1809
1824
|
export function takeUntil(notifier) {
|
|
1810
1825
|
return fa => {
|
|
1811
|
-
return
|
|
1812
|
-
from_1(notifier).provideEnvironment(environment).subscribe(tsplus_module_8.
|
|
1826
|
+
return new Observable((subscriber, environment) => {
|
|
1827
|
+
from_1(notifier).provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1813
1828
|
next: () => subscriber.complete(),
|
|
1814
1829
|
complete: tsplus_module_2.noop
|
|
1815
|
-
}));
|
|
1816
|
-
!subscriber.
|
|
1817
|
-
})
|
|
1830
|
+
})(subscriber));
|
|
1831
|
+
!subscriber._closed && fa.provideEnvironment(environment).subscribe(subscriber);
|
|
1832
|
+
});
|
|
1818
1833
|
};
|
|
1819
1834
|
}
|
|
1820
1835
|
function takeWhileWithIndex_1(predicate, inclusive) {
|
|
1821
1836
|
return fa => {
|
|
1822
|
-
return
|
|
1837
|
+
return new Observable((subscriber, environment) => {
|
|
1823
1838
|
let index = 0;
|
|
1824
|
-
|
|
1839
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1825
1840
|
next: value => {
|
|
1826
1841
|
const result = predicate(index++, value);
|
|
1827
1842
|
(result || inclusive) && subscriber.next(value);
|
|
1828
1843
|
!result && subscriber.complete();
|
|
1829
1844
|
}
|
|
1830
|
-
}));
|
|
1831
|
-
})
|
|
1845
|
+
})(subscriber));
|
|
1846
|
+
});
|
|
1832
1847
|
};
|
|
1833
1848
|
}
|
|
1834
1849
|
export function takeWhile(predicate, inclusive) {
|
|
@@ -1841,8 +1856,8 @@ export function takeWhile(predicate, inclusive) {
|
|
|
1841
1856
|
*/
|
|
1842
1857
|
export function tap(observer) {
|
|
1843
1858
|
return fa => {
|
|
1844
|
-
return
|
|
1845
|
-
|
|
1859
|
+
return new Observable((subscriber, environment) => {
|
|
1860
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1846
1861
|
next: value => {
|
|
1847
1862
|
observer.next?.(value);
|
|
1848
1863
|
subscriber.next(value);
|
|
@@ -1855,8 +1870,8 @@ export function tap(observer) {
|
|
|
1855
1870
|
observer.complete?.();
|
|
1856
1871
|
subscriber.complete();
|
|
1857
1872
|
}
|
|
1858
|
-
}));
|
|
1859
|
-
})
|
|
1873
|
+
})(subscriber));
|
|
1874
|
+
});
|
|
1860
1875
|
};
|
|
1861
1876
|
}
|
|
1862
1877
|
export const defaultThrottleConfig = {
|
|
@@ -1871,8 +1886,8 @@ function throttle_1(durationSelector, {
|
|
|
1871
1886
|
trailing
|
|
1872
1887
|
} = defaultThrottleConfig) {
|
|
1873
1888
|
return fa => {
|
|
1874
|
-
return
|
|
1875
|
-
let sendValue = tsplus_module_17.nothing(fileName_1 + ":
|
|
1889
|
+
return new Observable((subscriber, environment) => {
|
|
1890
|
+
let sendValue = tsplus_module_17.nothing(fileName_1 + ":2363:51");
|
|
1876
1891
|
let throttled = null;
|
|
1877
1892
|
let isComplete = false;
|
|
1878
1893
|
const endThrottling = () => {
|
|
@@ -1887,31 +1902,31 @@ function throttle_1(durationSelector, {
|
|
|
1887
1902
|
throttled = null;
|
|
1888
1903
|
isComplete && subscriber.complete();
|
|
1889
1904
|
};
|
|
1890
|
-
const startThrottling = value => throttled = from_1(durationSelector(value)).provideEnvironment(environment).subscribe(tsplus_module_8.
|
|
1905
|
+
const startThrottling = value => throttled = from_1(durationSelector(value)).provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1891
1906
|
next: endThrottling,
|
|
1892
1907
|
complete: cleanupThrottling
|
|
1893
|
-
}));
|
|
1908
|
+
})(subscriber));
|
|
1894
1909
|
const send = () => {
|
|
1895
1910
|
if (tsplus_module_18.isJust(sendValue)) {
|
|
1896
1911
|
const {
|
|
1897
1912
|
value
|
|
1898
1913
|
} = sendValue;
|
|
1899
|
-
sendValue = tsplus_module_17.nothing(fileName_1 + ":
|
|
1914
|
+
sendValue = tsplus_module_17.nothing(fileName_1 + ":2385:36");
|
|
1900
1915
|
subscriber.next(value);
|
|
1901
1916
|
!isComplete && startThrottling(value);
|
|
1902
1917
|
}
|
|
1903
1918
|
};
|
|
1904
|
-
|
|
1919
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1905
1920
|
next: value => {
|
|
1906
|
-
sendValue = tsplus_module_17.just(value, fileName_1 + ":
|
|
1907
|
-
!(throttled && !throttled.
|
|
1921
|
+
sendValue = tsplus_module_17.just(value, fileName_1 + ":2393:29");
|
|
1922
|
+
!(throttled && !throttled._closed) && (leading ? send() : startThrottling(value));
|
|
1908
1923
|
},
|
|
1909
1924
|
complete: () => {
|
|
1910
1925
|
isComplete = true;
|
|
1911
|
-
!(trailing && tsplus_module_18.isJust(sendValue) && throttled && !throttled.
|
|
1926
|
+
!(trailing && tsplus_module_18.isJust(sendValue) && throttled && !throttled._closed) && subscriber.complete();
|
|
1912
1927
|
}
|
|
1913
|
-
}));
|
|
1914
|
-
})
|
|
1928
|
+
})(subscriber));
|
|
1929
|
+
});
|
|
1915
1930
|
};
|
|
1916
1931
|
}
|
|
1917
1932
|
/**
|
|
@@ -1939,11 +1954,11 @@ export function timeout(config) {
|
|
|
1939
1954
|
scheduler = tsplus_module_5.asyncScheduler,
|
|
1940
1955
|
meta = null
|
|
1941
1956
|
} = config;
|
|
1942
|
-
return
|
|
1957
|
+
return new Observable((subscriber, environment) => {
|
|
1943
1958
|
// eslint-disable-next-line prefer-const
|
|
1944
1959
|
let originalSourceSubscription;
|
|
1945
1960
|
let timerSubscription;
|
|
1946
|
-
let lastValue = tsplus_module_17.nothing(fileName_1 + ":
|
|
1961
|
+
let lastValue = tsplus_module_17.nothing(fileName_1 + ":2474:40");
|
|
1947
1962
|
let seen = 0;
|
|
1948
1963
|
const startTimer = delay => {
|
|
1949
1964
|
timerSubscription = caughtSchedule(subscriber, scheduler, () => {
|
|
@@ -1955,22 +1970,23 @@ export function timeout(config) {
|
|
|
1955
1970
|
})).provideEnvironment(environment).subscribe(subscriber);
|
|
1956
1971
|
}, delay);
|
|
1957
1972
|
};
|
|
1958
|
-
originalSourceSubscription =
|
|
1973
|
+
originalSourceSubscription = fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1959
1974
|
next: value => {
|
|
1960
1975
|
timerSubscription?.unsubscribe();
|
|
1961
1976
|
seen++;
|
|
1962
|
-
lastValue = tsplus_module_17.just(value, fileName_1 + ":
|
|
1977
|
+
lastValue = tsplus_module_17.just(value, fileName_1 + ":2500:29");
|
|
1963
1978
|
subscriber.next(value);
|
|
1964
1979
|
each > 0 && startTimer(each);
|
|
1980
|
+
},
|
|
1981
|
+
finalize: () => {
|
|
1982
|
+
if (!timerSubscription?._closed) {
|
|
1983
|
+
timerSubscription?.unsubscribe();
|
|
1984
|
+
}
|
|
1985
|
+
lastValue = tsplus_module_17.nothing(fileName_1 + ":2508:32");
|
|
1965
1986
|
}
|
|
1966
|
-
}
|
|
1967
|
-
if (!timerSubscription?.closed) {
|
|
1968
|
-
timerSubscription?.unsubscribe();
|
|
1969
|
-
}
|
|
1970
|
-
lastValue = tsplus_module_17.nothing(fileName_1 + ":2520:32");
|
|
1971
|
-
}));
|
|
1987
|
+
})(subscriber));
|
|
1972
1988
|
startTimer(first != null ? typeof first === "number" ? first : +first - scheduler.now() : each);
|
|
1973
|
-
})
|
|
1989
|
+
});
|
|
1974
1990
|
};
|
|
1975
1991
|
}
|
|
1976
1992
|
function timeoutError(info) {
|
|
@@ -1983,18 +1999,18 @@ function toArrayAccumulator(arr, value) {
|
|
|
1983
1999
|
* @tsplus getter fncts.observable.Observable toArray
|
|
1984
2000
|
*/
|
|
1985
2001
|
function toArray_1(fa) {
|
|
1986
|
-
return
|
|
1987
|
-
foldLeft_1([], toArrayAccumulator)(
|
|
1988
|
-
})
|
|
2002
|
+
return new Observable((subscriber, environment) => {
|
|
2003
|
+
foldLeft_1([], toArrayAccumulator)(fa).provideEnvironment(environment).subscribe(subscriber);
|
|
2004
|
+
});
|
|
1989
2005
|
}
|
|
1990
2006
|
/**
|
|
1991
2007
|
* @tsplus pipeable fncts.observable.Observable unique
|
|
1992
2008
|
*/
|
|
1993
2009
|
export function unique(toKey, flushes) {
|
|
1994
2010
|
return fa => {
|
|
1995
|
-
return
|
|
2011
|
+
return new Observable((subscriber, environment) => {
|
|
1996
2012
|
let distinctKeys = tsplus_module_21.empty();
|
|
1997
|
-
|
|
2013
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
1998
2014
|
next: value => {
|
|
1999
2015
|
const key = toKey ? toKey(value) : value;
|
|
2000
2016
|
if (!tsplus_module_21.has(key)(distinctKeys)) {
|
|
@@ -2002,21 +2018,21 @@ export function unique(toKey, flushes) {
|
|
|
2002
2018
|
subscriber.next(value);
|
|
2003
2019
|
}
|
|
2004
2020
|
}
|
|
2005
|
-
}));
|
|
2006
|
-
flushes?.provideEnvironment(environment).subscribe(tsplus_module_8.
|
|
2021
|
+
})(subscriber));
|
|
2022
|
+
flushes?.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
2007
2023
|
next: () => distinctKeys = tsplus_module_21.empty(),
|
|
2008
2024
|
complete: tsplus_module_2.noop
|
|
2009
|
-
}));
|
|
2010
|
-
})
|
|
2025
|
+
})(subscriber));
|
|
2026
|
+
});
|
|
2011
2027
|
};
|
|
2012
2028
|
}
|
|
2013
2029
|
function uniqueUntilChanged_1(E, keySelector = tsplus_module_13.identity) {
|
|
2014
2030
|
return fa => {
|
|
2015
2031
|
const compare = "equals" in E ? E.equals : E;
|
|
2016
|
-
return
|
|
2032
|
+
return new Observable((subscriber, environment) => {
|
|
2017
2033
|
let previousKey;
|
|
2018
2034
|
let first = true;
|
|
2019
|
-
|
|
2035
|
+
fa.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
2020
2036
|
next: value => {
|
|
2021
2037
|
const currentKey = keySelector(value);
|
|
2022
2038
|
if (first || !compare(previousKey, currentKey)) {
|
|
@@ -2025,8 +2041,8 @@ function uniqueUntilChanged_1(E, keySelector = tsplus_module_13.identity) {
|
|
|
2025
2041
|
subscriber.next(value);
|
|
2026
2042
|
}
|
|
2027
2043
|
}
|
|
2028
|
-
}));
|
|
2029
|
-
})
|
|
2044
|
+
})(subscriber));
|
|
2045
|
+
});
|
|
2030
2046
|
};
|
|
2031
2047
|
}
|
|
2032
2048
|
export function uniqueUntilKeyChanged(key, equals) {
|
|
@@ -2048,7 +2064,7 @@ function combineLatestInternal(subscriber, environment, observables, scheduler,
|
|
|
2048
2064
|
maybeSchedule(subscriber, scheduler, () => {
|
|
2049
2065
|
const source = scheduler ? scheduled_1(scheduler)(observables[i]) : from_1(observables[i]);
|
|
2050
2066
|
let hasFirstValue = false;
|
|
2051
|
-
source.provideEnvironment(environment).subscribe(tsplus_module_8.
|
|
2067
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
2052
2068
|
next: value => {
|
|
2053
2069
|
values[i] = value;
|
|
2054
2070
|
if (!hasFirstValue) {
|
|
@@ -2064,28 +2080,28 @@ function combineLatestInternal(subscriber, environment, observables, scheduler,
|
|
|
2064
2080
|
subscriber.complete();
|
|
2065
2081
|
}
|
|
2066
2082
|
}
|
|
2067
|
-
}));
|
|
2083
|
+
})(subscriber));
|
|
2068
2084
|
});
|
|
2069
2085
|
}
|
|
2070
2086
|
});
|
|
2071
2087
|
}
|
|
2072
|
-
function findInternal(predicate, emit) {
|
|
2088
|
+
function findInternal(source, predicate, emit) {
|
|
2073
2089
|
const findIndex = emit === "index";
|
|
2074
|
-
return (
|
|
2090
|
+
return (subscriber, environment) => {
|
|
2075
2091
|
let index = 0;
|
|
2076
|
-
source.provideEnvironment(environment).subscribe(tsplus_module_8.
|
|
2092
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
2077
2093
|
next: value => {
|
|
2078
2094
|
const i = index++;
|
|
2079
2095
|
if (predicate(index++, value)) {
|
|
2080
|
-
subscriber.next(findIndex ? i : tsplus_module_17.just(value, fileName_1 + ":
|
|
2096
|
+
subscriber.next(findIndex ? i : tsplus_module_17.just(value, fileName_1 + ":2678:49"));
|
|
2081
2097
|
subscriber.complete();
|
|
2082
2098
|
}
|
|
2083
2099
|
},
|
|
2084
2100
|
complete: () => {
|
|
2085
|
-
subscriber.next(findIndex ? -1 : tsplus_module_17.nothing(fileName_1 + ":
|
|
2101
|
+
subscriber.next(findIndex ? -1 : tsplus_module_17.nothing(fileName_1 + ":2683:51"));
|
|
2086
2102
|
subscriber.complete();
|
|
2087
2103
|
}
|
|
2088
|
-
}));
|
|
2104
|
+
})(subscriber));
|
|
2089
2105
|
};
|
|
2090
2106
|
}
|
|
2091
2107
|
export function joinAllInternal(fa, joiner) {
|
|
@@ -2151,22 +2167,20 @@ function mergeInternal(source, subscriber, environment, f, concurrent, onBeforeN
|
|
|
2151
2167
|
additionalTeardown?.();
|
|
2152
2168
|
};
|
|
2153
2169
|
}
|
|
2154
|
-
export function scanInternal(f, initial, hasInitial, emitOnNext, emitBeforeComplete) {
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
}));
|
|
2170
|
-
};
|
|
2170
|
+
export function scanInternal(source, subscriber, environment, f, initial, hasInitial, emitOnNext, emitBeforeComplete) {
|
|
2171
|
+
let hasState = hasInitial;
|
|
2172
|
+
let state = initial;
|
|
2173
|
+
let index = 0;
|
|
2174
|
+
return source.provideEnvironment(environment).subscribe(tsplus_module_8.operate_({
|
|
2175
|
+
next: value => {
|
|
2176
|
+
const i = index++;
|
|
2177
|
+
state = hasState ? f(i, state, value) : (hasState = true, value);
|
|
2178
|
+
emitOnNext && subscriber.next(state);
|
|
2179
|
+
},
|
|
2180
|
+
complete: emitBeforeComplete && (() => {
|
|
2181
|
+
hasState && subscriber.next(state);
|
|
2182
|
+
subscriber.complete();
|
|
2183
|
+
})
|
|
2184
|
+
})(subscriber));
|
|
2171
2185
|
}
|
|
2172
2186
|
//# sourceMappingURL=api.mjs.map
|