@fncts/observable 0.0.8 → 0.0.10
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/BehaviorSubject.d.ts +2 -2
- package/Notification.d.ts +4 -4
- package/Observable/api/connect.d.ts +2 -2
- package/Observable/api/connectable.d.ts +2 -2
- package/Observable/api/fromEvent.d.ts +4 -0
- package/Observable/api/race.d.ts +2 -1
- package/Observable/api/raceWith.d.ts +2 -2
- package/Observable/api/repeatWhen.d.ts +5 -2
- package/Observable/api/retryWhen.d.ts +2 -3
- package/Observable/api/share.d.ts +5 -4
- package/Observable/api/window.d.ts +2 -2
- package/Observable/api/windowCount.d.ts +2 -2
- package/Observable/api/windowTime.d.ts +5 -5
- package/Observable/api/windowToggle.d.ts +3 -3
- package/Observable/api/windowWhen.d.ts +3 -3
- package/Observable/api.d.ts +188 -194
- package/Observable/definition.d.ts +8 -6
- package/Operator.d.ts +2 -2
- package/_cjs/Action.cjs.map +1 -1
- package/_cjs/AnimationFrameAction.cjs.map +1 -1
- package/_cjs/AnimationFrameScheduler.cjs +0 -1
- package/_cjs/AnimationFrameScheduler.cjs.map +1 -1
- package/_cjs/BehaviorSubject.cjs +1 -1
- package/_cjs/BehaviorSubject.cjs.map +1 -1
- package/_cjs/Notification.cjs +21 -17
- package/_cjs/Notification.cjs.map +1 -1
- package/_cjs/Observable/api/connect.cjs +12 -10
- package/_cjs/Observable/api/connect.cjs.map +1 -1
- package/_cjs/Observable/api/connectable.cjs +6 -4
- package/_cjs/Observable/api/connectable.cjs.map +1 -1
- package/_cjs/Observable/api/fromCallback.cjs.map +1 -1
- package/_cjs/Observable/api/fromEvent.cjs +3 -0
- package/_cjs/Observable/api/fromEvent.cjs.map +1 -1
- package/_cjs/Observable/api/race.cjs +2 -2
- package/_cjs/Observable/api/race.cjs.map +1 -1
- package/_cjs/Observable/api/raceWith.cjs +8 -6
- package/_cjs/Observable/api/raceWith.cjs.map +1 -1
- package/_cjs/Observable/api/repeatWhen.cjs +46 -46
- package/_cjs/Observable/api/repeatWhen.cjs.map +1 -1
- package/_cjs/Observable/api/retryWhen.cjs +31 -38
- package/_cjs/Observable/api/retryWhen.cjs.map +1 -1
- package/_cjs/Observable/api/share.cjs +66 -64
- package/_cjs/Observable/api/share.cjs.map +1 -1
- package/_cjs/Observable/api/window.cjs +35 -33
- package/_cjs/Observable/api/window.cjs.map +1 -1
- package/_cjs/Observable/api/windowCount.cjs +41 -39
- package/_cjs/Observable/api/windowCount.cjs.map +1 -1
- package/_cjs/Observable/api/windowTime.cjs +66 -64
- package/_cjs/Observable/api/windowTime.cjs.map +1 -1
- package/_cjs/Observable/api/windowToggle.cjs +63 -61
- package/_cjs/Observable/api/windowToggle.cjs.map +1 -1
- package/_cjs/Observable/api/windowWhen.cjs +43 -41
- package/_cjs/Observable/api/windowWhen.cjs.map +1 -1
- package/_cjs/Observable/api.cjs +1270 -1105
- package/_cjs/Observable/api.cjs.map +1 -1
- package/_cjs/Observable/definition.cjs +9 -8
- package/_cjs/Observable/definition.cjs.map +1 -1
- package/_cjs/Observable/dom/animationFrames.cjs.map +1 -1
- package/_cjs/Observable.cjs.map +1 -1
- package/_cjs/Operator.cjs +11 -9
- package/_cjs/Operator.cjs.map +1 -1
- package/_cjs/Scheduler.cjs +0 -5
- package/_cjs/Scheduler.cjs.map +1 -1
- package/_cjs/Subject.cjs +3 -3
- package/_cjs/Subject.cjs.map +1 -1
- package/_cjs/Subscriber.cjs.map +1 -1
- package/_cjs/internal/util.cjs.map +1 -1
- package/_mjs/Action.mjs.map +1 -1
- package/_mjs/AnimationFrameAction.mjs.map +1 -1
- package/_mjs/AnimationFrameScheduler.mjs +0 -2
- package/_mjs/AnimationFrameScheduler.mjs.map +1 -1
- package/_mjs/BehaviorSubject.mjs +1 -1
- package/_mjs/BehaviorSubject.mjs.map +1 -1
- package/_mjs/Notification.mjs +18 -14
- package/_mjs/Notification.mjs.map +1 -1
- package/_mjs/Observable/api/connect.mjs +12 -10
- package/_mjs/Observable/api/connect.mjs.map +1 -1
- package/_mjs/Observable/api/connectable.mjs +6 -4
- package/_mjs/Observable/api/connectable.mjs.map +1 -1
- package/_mjs/Observable/api/fromCallback.mjs.map +1 -1
- package/_mjs/Observable/api/fromEvent.mjs +4 -0
- package/_mjs/Observable/api/fromEvent.mjs.map +1 -1
- package/_mjs/Observable/api/race.mjs +2 -2
- package/_mjs/Observable/api/race.mjs.map +1 -1
- package/_mjs/Observable/api/raceWith.mjs +7 -5
- package/_mjs/Observable/api/raceWith.mjs.map +1 -1
- package/_mjs/Observable/api/repeatWhen.mjs +47 -44
- package/_mjs/Observable/api/repeatWhen.mjs.map +1 -1
- package/_mjs/Observable/api/retryWhen.mjs +30 -33
- package/_mjs/Observable/api/retryWhen.mjs.map +1 -1
- package/_mjs/Observable/api/share.mjs +63 -61
- package/_mjs/Observable/api/share.mjs.map +1 -1
- package/_mjs/Observable/api/window.mjs +32 -30
- package/_mjs/Observable/api/window.mjs.map +1 -1
- package/_mjs/Observable/api/windowCount.mjs +40 -38
- package/_mjs/Observable/api/windowCount.mjs.map +1 -1
- package/_mjs/Observable/api/windowTime.mjs +60 -58
- package/_mjs/Observable/api/windowTime.mjs.map +1 -1
- package/_mjs/Observable/api/windowToggle.mjs +56 -54
- package/_mjs/Observable/api/windowToggle.mjs.map +1 -1
- package/_mjs/Observable/api/windowWhen.mjs +42 -40
- package/_mjs/Observable/api/windowWhen.mjs.map +1 -1
- package/_mjs/Observable/api.mjs +1198 -1031
- package/_mjs/Observable/api.mjs.map +1 -1
- package/_mjs/Observable/definition.mjs +9 -8
- package/_mjs/Observable/definition.mjs.map +1 -1
- package/_mjs/Observable/dom/animationFrames.mjs.map +1 -1
- package/_mjs/Observable.mjs.map +1 -1
- package/_mjs/Operator.mjs +11 -9
- package/_mjs/Operator.mjs.map +1 -1
- package/_mjs/Scheduler.mjs +0 -6
- package/_mjs/Scheduler.mjs.map +1 -1
- package/_mjs/Subject.mjs +3 -3
- package/_mjs/Subject.mjs.map +1 -1
- package/_mjs/Subscriber.mjs.map +1 -1
- package/_mjs/internal/util.mjs.map +1 -1
- package/_src/Action.ts +0 -1
- package/_src/AnimationFrameAction.ts +0 -2
- package/_src/AnimationFrameScheduler.ts +2 -7
- package/_src/BehaviorSubject.ts +3 -3
- package/_src/Notification.ts +21 -23
- package/_src/Observable/api/connect.ts +12 -9
- package/_src/Observable/api/connectable.ts +6 -7
- package/_src/Observable/api/fromCallback.ts +0 -1
- package/_src/Observable/api/fromEvent.ts +3 -0
- package/_src/Observable/api/race.ts +15 -13
- package/_src/Observable/api/raceWith.ts +15 -14
- package/_src/Observable/api/repeatWhen.ts +51 -56
- package/_src/Observable/api/retryWhen.ts +38 -43
- package/_src/Observable/api/share.ts +63 -71
- package/_src/Observable/api/window.ts +36 -41
- package/_src/Observable/api/windowCount.ts +44 -51
- package/_src/Observable/api/windowTime.ts +69 -81
- package/_src/Observable/api/windowToggle.ts +69 -73
- package/_src/Observable/api/windowWhen.ts +49 -55
- package/_src/Observable/api.ts +1489 -1495
- package/_src/Observable/definition.ts +24 -18
- package/_src/Observable/dom/animationFrames.ts +16 -6
- package/_src/Observable/instances.ts +0 -23
- package/_src/Observable.ts +0 -2
- package/_src/Operator.ts +20 -15
- package/_src/Scheduler.ts +0 -6
- package/_src/Subject.ts +1 -1
- package/_src/Subscriber.ts +3 -2
- package/_src/internal/util.ts +8 -4
- package/package.json +2 -2
package/_mjs/Observable/api.mjs
CHANGED
|
@@ -35,42 +35,42 @@ export const fromIO = fromIO_1;
|
|
|
35
35
|
export const zipWith = zipWith_1;
|
|
36
36
|
export const mapWithIndex = mapWithIndex_1;
|
|
37
37
|
export const map_ = map_1;
|
|
38
|
-
export const
|
|
39
|
-
export const
|
|
38
|
+
export const as = as_1;
|
|
39
|
+
export const filterWithIndex = filterWithIndex_1;
|
|
40
40
|
export const filterMapWithIndex = filterMapWithIndex_1;
|
|
41
41
|
export const partitionWithIndex = partitionWithIndex_1;
|
|
42
|
-
export const
|
|
42
|
+
export const partitionMapWithIndex = partitionMapWithIndex_1;
|
|
43
43
|
export const mergeMapWithIndex = mergeMapWithIndex_1;
|
|
44
|
-
export const
|
|
44
|
+
export const mergeMap = mergeMap_1;
|
|
45
45
|
export const contramapEnvironment = contramapEnvironment_1;
|
|
46
46
|
export const foldLeftWithIndex = foldLeftWithIndex_1;
|
|
47
47
|
export const foldLeft = foldLeft_1;
|
|
48
|
-
export const
|
|
48
|
+
export const audit = audit_1;
|
|
49
49
|
export const catchAllCause = catchAllCause_1;
|
|
50
50
|
export const concatAll = concatAll_1;
|
|
51
|
-
export const
|
|
51
|
+
export const concat = concat_1;
|
|
52
52
|
export const countWithIndex = countWithIndex_1;
|
|
53
|
-
export const
|
|
53
|
+
export const zipLatest = zipLatest_1;
|
|
54
54
|
export const delayWithIndex = delayWithIndex_1;
|
|
55
|
-
export const
|
|
55
|
+
export const delayWith = delayWith_1;
|
|
56
56
|
export const exhaustMapWithIndex = exhaustMapWithIndex_1;
|
|
57
57
|
export const expandWithIndex = expandWithIndex_1;
|
|
58
58
|
export const findWithIndex = findWithIndex_1;
|
|
59
59
|
export const findIndexWithIndex = findIndexWithIndex_1;
|
|
60
|
-
export const
|
|
60
|
+
export const mergeAll = mergeAll_1;
|
|
61
61
|
export const mergeScanWithIndex = mergeScanWithIndex_1;
|
|
62
|
-
export const
|
|
63
|
-
export const
|
|
62
|
+
export const onEmpty = onEmpty_1;
|
|
63
|
+
export const sample = sample_1;
|
|
64
64
|
export const scanLeftWithIndex = scanLeftWithIndex_1;
|
|
65
65
|
export const serviceWithObservable = serviceWithObservable_1;
|
|
66
66
|
export const switchMapWithIndex = switchMapWithIndex_1;
|
|
67
|
-
export const
|
|
67
|
+
export const switchMap = switchMap_1;
|
|
68
68
|
export const switchScanWithIndex = switchScanWithIndex_1;
|
|
69
|
-
export const
|
|
69
|
+
export const take = take_1;
|
|
70
70
|
export const takeWhileWithIndex = takeWhileWithIndex_1;
|
|
71
|
-
export const
|
|
71
|
+
export const throttle = throttle_1;
|
|
72
72
|
export const toArray = toArray_1;
|
|
73
|
-
export const
|
|
73
|
+
export const uniqueUntilChanged = uniqueUntilChanged_1;
|
|
74
74
|
import { popNumber } from "@fncts/observable/internal/args";
|
|
75
75
|
import { arrayOrObject, arrayRemove, readableStreamToAsyncGenerator } from "@fncts/observable/internal/util";
|
|
76
76
|
import { EMPTY, EnvironmentWith, Observable } from "@fncts/observable/Observable/definition";
|
|
@@ -87,8 +87,8 @@ export function halt(defect) {
|
|
|
87
87
|
*/
|
|
88
88
|
|
|
89
89
|
function defer_1(observable) {
|
|
90
|
-
return new Observable(s => {
|
|
91
|
-
from_1(observable()).subscribe(s);
|
|
90
|
+
return new Observable((s, environment) => {
|
|
91
|
+
from_1(observable()).provideEnvironment(environment).subscribe(s);
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
@@ -268,7 +268,7 @@ function interval_1(period = 0, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
268
268
|
|
|
269
269
|
export function merge(...sources) {
|
|
270
270
|
const concurrency = popNumber(sources, Infinity);
|
|
271
|
-
return !sources.length ? empty_1() : sources.length === 1 ? from_1(sources[0]) : mergeAll_1(fromArrayLike(sources)
|
|
271
|
+
return !sources.length ? empty_1() : sources.length === 1 ? from_1(sources[0]) : mergeAll_1(concurrency)(fromArrayLike(sources));
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
274
274
|
* @tsplus static fncts.observable.ObservableOps of
|
|
@@ -289,33 +289,35 @@ function single_1(a) {
|
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
/**
|
|
292
|
-
* @tsplus
|
|
292
|
+
* @tsplus pipeable fncts.observable.Observable scheduled
|
|
293
293
|
* @tsplus static fncts.observable.ObservableOps scheduled
|
|
294
294
|
*/
|
|
295
295
|
|
|
296
296
|
|
|
297
|
-
function scheduled_1(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
function scheduled_1(scheduler) {
|
|
298
|
+
return input => {
|
|
299
|
+
if (tsplus_module_2.isArrayLike(input)) {
|
|
300
|
+
return scheduleArray(input, scheduler);
|
|
301
|
+
}
|
|
301
302
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
if (tsplus_module_2.isPromiseLike(input)) {
|
|
304
|
+
return schedulePromise(input, scheduler);
|
|
305
|
+
}
|
|
305
306
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
307
|
+
if (tsplus_module_3.isIterable(input)) {
|
|
308
|
+
return scheduleIterable(input, scheduler);
|
|
309
|
+
}
|
|
309
310
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
if (tsplus_module_2.isAsyncIterable(input)) {
|
|
312
|
+
return scheduleAsyncIterable(input, scheduler);
|
|
313
|
+
}
|
|
313
314
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
if (tsplus_module_2.isReadableStream(input)) {
|
|
316
|
+
return scheduleReadableStreamLike(input, scheduler);
|
|
317
|
+
}
|
|
317
318
|
|
|
318
|
-
|
|
319
|
+
return scheduleObservable(from_1(input), scheduler);
|
|
320
|
+
};
|
|
319
321
|
}
|
|
320
322
|
|
|
321
323
|
export function scheduleArray(input, scheduler) {
|
|
@@ -376,10 +378,10 @@ export function scheduleIterable(input, scheduler) {
|
|
|
376
378
|
});
|
|
377
379
|
}
|
|
378
380
|
export function scheduleObservable(input, scheduler) {
|
|
379
|
-
return new Observable(subscriber => {
|
|
381
|
+
return new Observable((subscriber, environment) => {
|
|
380
382
|
const sub = new tsplus_module_6.Subscription();
|
|
381
383
|
sub.add(scheduler.schedule(() => {
|
|
382
|
-
sub.add(input.subscribe({
|
|
384
|
+
sub.add(input.provideEnvironment(environment).subscribe({
|
|
383
385
|
next: value => {
|
|
384
386
|
sub.add(scheduler.schedule(() => subscriber.next(value)));
|
|
385
387
|
},
|
|
@@ -450,7 +452,7 @@ function timer_1(time = 0, intervalOrScheduler, scheduler = tsplus_module_5.asyn
|
|
|
450
452
|
|
|
451
453
|
|
|
452
454
|
export function makeZip(...sources) {
|
|
453
|
-
return sources.length ? new Observable(subscriber => {
|
|
455
|
+
return sources.length ? new Observable((subscriber, environment) => {
|
|
454
456
|
let buffers = sources.map(() => []);
|
|
455
457
|
let completed = sources.map(() => false);
|
|
456
458
|
subscriber.add(() => {
|
|
@@ -458,7 +460,7 @@ export function makeZip(...sources) {
|
|
|
458
460
|
});
|
|
459
461
|
|
|
460
462
|
for (let sourceIndex = 0; !subscriber.closed && sourceIndex < sources.length; sourceIndex++) {
|
|
461
|
-
from_1(sources[sourceIndex]).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
463
|
+
from_1(sources[sourceIndex]).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
462
464
|
next: value => {
|
|
463
465
|
buffers[sourceIndex].push(value);
|
|
464
466
|
|
|
@@ -491,17 +493,17 @@ function fromIO_1(io, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
491
493
|
return new Observable((s, env) => {
|
|
492
494
|
let fiber;
|
|
493
495
|
const scheduled = scheduler.schedule(() => {
|
|
494
|
-
fiber = tsplus_module_10.unsafeRunFiber(tsplus_module_9.
|
|
496
|
+
fiber = tsplus_module_10.unsafeRunFiber(tsplus_module_9.provideEnvironment(env, fileName_1 + ":489:36")(io), fileName_1 + ":489:56");
|
|
495
497
|
fiber.unsafeOnDone(exit => {
|
|
496
498
|
if (!s.closed) {
|
|
497
|
-
tsplus_module_11.
|
|
499
|
+
tsplus_module_11.match(cause => s.error(cause), a => s.next(a))(tsplus_module_11.flatten(exit));
|
|
498
500
|
s.complete();
|
|
499
501
|
}
|
|
500
502
|
});
|
|
501
503
|
});
|
|
502
504
|
return () => {
|
|
503
505
|
scheduled.unsubscribe();
|
|
504
|
-
fiber && tsplus_module_10.unsafeRunAsync(tsplus_module_12.interrupt(fiber, fileName_1 + ":
|
|
506
|
+
fiber && tsplus_module_10.unsafeRunAsync(tsplus_module_12.interrupt(fiber, fileName_1 + ":502:21"), fileName_1 + ":502:46");
|
|
505
507
|
};
|
|
506
508
|
});
|
|
507
509
|
}
|
|
@@ -512,213 +514,248 @@ function fromIO_1(io, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
512
514
|
|
|
513
515
|
export const unit = /*#__PURE__*/single_1(undefined);
|
|
514
516
|
/**
|
|
515
|
-
* @tsplus
|
|
517
|
+
* @tsplus pipeable fncts.observable.Observable zipWith
|
|
516
518
|
*/
|
|
517
519
|
|
|
518
|
-
function zipWith_1(
|
|
519
|
-
return
|
|
520
|
+
function zipWith_1(fb, f) {
|
|
521
|
+
return fa => {
|
|
522
|
+
return mergeMap_1(a => map_1(b => f(a, b))(fb))(fa);
|
|
523
|
+
};
|
|
520
524
|
}
|
|
521
525
|
/**
|
|
522
|
-
* @tsplus
|
|
526
|
+
* @tsplus pipeable fncts.observable.Observable zip
|
|
523
527
|
*/
|
|
524
528
|
|
|
525
529
|
|
|
526
|
-
export function zip(
|
|
527
|
-
return
|
|
530
|
+
export function zip(fb) {
|
|
531
|
+
return fa => {
|
|
532
|
+
return zipWith_1(fb, tsplus_module_13.tuple)(fa);
|
|
533
|
+
};
|
|
528
534
|
}
|
|
529
535
|
/**
|
|
530
|
-
* @tsplus
|
|
536
|
+
* @tsplus pipeable fncts.observable.Observable ap
|
|
531
537
|
*/
|
|
532
538
|
|
|
533
|
-
export function ap(
|
|
534
|
-
return
|
|
539
|
+
export function ap(fa) {
|
|
540
|
+
return fab => {
|
|
541
|
+
return zipWith_1(fa, (f, a) => f(a))(fab);
|
|
542
|
+
};
|
|
535
543
|
}
|
|
536
544
|
/**
|
|
537
|
-
* @tsplus
|
|
545
|
+
* @tsplus pipeable fncts.observable.Observable mapWithIndex
|
|
538
546
|
*/
|
|
539
547
|
|
|
540
|
-
function mapWithIndex_1(
|
|
541
|
-
return
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
548
|
+
function mapWithIndex_1(f) {
|
|
549
|
+
return fa => {
|
|
550
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
551
|
+
let i = 0;
|
|
552
|
+
source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
553
|
+
next: value => {
|
|
554
|
+
subscriber.next(f(i++, value));
|
|
555
|
+
}
|
|
556
|
+
}));
|
|
557
|
+
})(fa);
|
|
558
|
+
};
|
|
549
559
|
}
|
|
550
560
|
/**
|
|
551
|
-
* @tsplus
|
|
561
|
+
* @tsplus pipeable fncts.observable.Observable map
|
|
552
562
|
*/
|
|
553
563
|
|
|
554
564
|
|
|
555
|
-
function map_1(
|
|
556
|
-
return
|
|
565
|
+
function map_1(f) {
|
|
566
|
+
return fa => {
|
|
567
|
+
return mapWithIndex_1((_, a) => f(a))(fa);
|
|
568
|
+
};
|
|
557
569
|
}
|
|
558
570
|
/**
|
|
559
|
-
* @tsplus
|
|
571
|
+
* @tsplus pipeable fncts.observable.Observable as
|
|
560
572
|
*/
|
|
561
573
|
|
|
562
574
|
|
|
563
|
-
function as_1(
|
|
564
|
-
return
|
|
575
|
+
function as_1(b) {
|
|
576
|
+
return fa => {
|
|
577
|
+
return map_1(b)(fa);
|
|
578
|
+
};
|
|
565
579
|
}
|
|
566
580
|
/**
|
|
567
|
-
* @tsplus
|
|
581
|
+
* @tsplus pipeable fncts.observable.Observable mapError
|
|
568
582
|
*/
|
|
569
583
|
|
|
570
584
|
|
|
571
|
-
export function
|
|
572
|
-
return
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
585
|
+
export function mapError(f) {
|
|
586
|
+
return fa => {
|
|
587
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
588
|
+
source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
589
|
+
error: err => {
|
|
590
|
+
subscriber.error(tsplus_module_1.map(f)(err));
|
|
591
|
+
}
|
|
592
|
+
}));
|
|
593
|
+
})(fa);
|
|
594
|
+
};
|
|
579
595
|
}
|
|
580
596
|
/**
|
|
581
597
|
* @tsplus getter fncts.observable.Observable swap
|
|
582
598
|
*/
|
|
583
599
|
|
|
584
600
|
export function swap(fa) {
|
|
585
|
-
return tsplus_module_8.operate_(
|
|
586
|
-
source.subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
601
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
602
|
+
source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
587
603
|
next: value => {
|
|
588
604
|
subscriber.error(tsplus_module_1.fail(value));
|
|
589
605
|
},
|
|
590
606
|
error: err => {
|
|
591
|
-
tsplus_module_14.
|
|
607
|
+
tsplus_module_14.match(e => {
|
|
592
608
|
subscriber.next(e);
|
|
593
609
|
}, cause => {
|
|
594
610
|
subscriber.error(cause);
|
|
595
|
-
});
|
|
611
|
+
})(tsplus_module_1.failureOrCause(err));
|
|
596
612
|
}
|
|
597
613
|
}));
|
|
598
|
-
});
|
|
614
|
+
})(fa);
|
|
599
615
|
}
|
|
600
616
|
|
|
601
|
-
function filterWithIndex_1(
|
|
602
|
-
return
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
617
|
+
function filterWithIndex_1(predicate) {
|
|
618
|
+
return fa => {
|
|
619
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
620
|
+
let index = 0;
|
|
621
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
622
|
+
next: value => predicate(index++, value) && subscriber.next(value)
|
|
623
|
+
}));
|
|
624
|
+
})(fa);
|
|
625
|
+
};
|
|
608
626
|
}
|
|
609
627
|
|
|
610
|
-
export function
|
|
611
|
-
return
|
|
628
|
+
export function filter(predicate) {
|
|
629
|
+
return fa => {
|
|
630
|
+
return filterWithIndex_1((_, a) => predicate(a))(fa);
|
|
631
|
+
};
|
|
612
632
|
}
|
|
613
633
|
/**
|
|
614
|
-
* @tsplus
|
|
634
|
+
* @tsplus pipeable fncts.observable.Observable filterMapWithIndex
|
|
615
635
|
*/
|
|
616
636
|
|
|
617
|
-
function filterMapWithIndex_1(
|
|
618
|
-
return
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
637
|
+
function filterMapWithIndex_1(f) {
|
|
638
|
+
return fa => {
|
|
639
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
640
|
+
let index = 0;
|
|
641
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
642
|
+
next: value => tsplus_module_15.match(() => tsplus_module_2.noop, b => subscriber.next(b))(f(index++, value))
|
|
643
|
+
}));
|
|
644
|
+
})(fa);
|
|
645
|
+
};
|
|
624
646
|
}
|
|
625
647
|
/**
|
|
626
|
-
* @tsplus
|
|
648
|
+
* @tsplus pipeable fncts.observable.Observable filterMap
|
|
627
649
|
*/
|
|
628
650
|
|
|
629
651
|
|
|
630
|
-
export function
|
|
631
|
-
return
|
|
652
|
+
export function filterMap(f) {
|
|
653
|
+
return fa => {
|
|
654
|
+
return filterMapWithIndex_1((_, a) => f(a))(fa);
|
|
655
|
+
};
|
|
632
656
|
}
|
|
633
657
|
|
|
634
|
-
function partitionWithIndex_1(
|
|
635
|
-
return
|
|
658
|
+
function partitionWithIndex_1(predicate) {
|
|
659
|
+
return fa => {
|
|
660
|
+
return [filterWithIndex_1((i, a) => !predicate(i, a))(fa), filterWithIndex_1(predicate)(fa)];
|
|
661
|
+
};
|
|
636
662
|
}
|
|
637
663
|
|
|
638
|
-
export function
|
|
639
|
-
return
|
|
664
|
+
export function partition(predicate) {
|
|
665
|
+
return fa => {
|
|
666
|
+
return partitionWithIndex_1((_, a) => predicate(a))(fa);
|
|
667
|
+
};
|
|
640
668
|
}
|
|
641
669
|
/**
|
|
642
|
-
* @tsplus
|
|
670
|
+
* @tsplus pipeable fncts.observable.Observable partitionMapWithIndex
|
|
643
671
|
*/
|
|
644
672
|
|
|
645
|
-
function partitionMapWithIndex_1(
|
|
646
|
-
return
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
673
|
+
function partitionMapWithIndex_1(f) {
|
|
674
|
+
return fa => {
|
|
675
|
+
return [tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
676
|
+
let index = 0;
|
|
677
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
678
|
+
next: value => {
|
|
679
|
+
tsplus_module_14.match(b => subscriber.next(b), tsplus_module_2.noop)(f(index++, value));
|
|
680
|
+
}
|
|
681
|
+
}));
|
|
682
|
+
})(fa), tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
683
|
+
let index = 0;
|
|
684
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
685
|
+
next: value => {
|
|
686
|
+
tsplus_module_14.match(tsplus_module_2.noop, c => subscriber.next(c))(f(index++, value));
|
|
687
|
+
}
|
|
688
|
+
}));
|
|
689
|
+
})(fa)];
|
|
690
|
+
};
|
|
661
691
|
}
|
|
662
692
|
/**
|
|
663
|
-
* @tsplus
|
|
693
|
+
* @tsplus pipeable fncts.observable.Observable partitionMap
|
|
664
694
|
*/
|
|
665
695
|
|
|
666
696
|
|
|
667
|
-
export function
|
|
668
|
-
return
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
* @tsplus fluent fncts.observable.Observable provideEnvironment
|
|
672
|
-
*/
|
|
673
|
-
|
|
674
|
-
export function provideEnvironment(self, environment) {
|
|
675
|
-
return self.provide(environment);
|
|
697
|
+
export function partitionMap(f) {
|
|
698
|
+
return fa => {
|
|
699
|
+
return partitionMapWithIndex_1((_, a) => f(a))(fa);
|
|
700
|
+
};
|
|
676
701
|
}
|
|
677
702
|
/**
|
|
678
|
-
* @tsplus
|
|
703
|
+
* @tsplus pipeable fncts.observable.Observable provideService
|
|
679
704
|
*/
|
|
680
705
|
|
|
681
|
-
export function provideService(
|
|
706
|
+
export function provideService(service,
|
|
682
707
|
/** @tsplus auto */
|
|
683
708
|
tag) {
|
|
684
|
-
return
|
|
709
|
+
return self => {
|
|
710
|
+
return contramapEnvironment_1(environment => tsplus_module_16.add(service, tag)(environment))(self);
|
|
711
|
+
};
|
|
685
712
|
}
|
|
686
713
|
/**
|
|
687
|
-
* @tsplus
|
|
714
|
+
* @tsplus pipeable fncts.observable.Observable mergeMapWithIndex
|
|
688
715
|
*/
|
|
689
716
|
|
|
690
|
-
function mergeMapWithIndex_1(
|
|
691
|
-
return
|
|
717
|
+
function mergeMapWithIndex_1(f, concurrent = Infinity) {
|
|
718
|
+
return ma => {
|
|
719
|
+
return tsplus_module_8.operate_((source, sub, environment) => mergeInternal(source, sub, environment, f, concurrent))(ma);
|
|
720
|
+
};
|
|
692
721
|
}
|
|
693
722
|
/**
|
|
694
|
-
* @tsplus
|
|
723
|
+
* @tsplus pipeable fncts.observable.Observable mergeMap
|
|
695
724
|
*/
|
|
696
725
|
|
|
697
726
|
|
|
698
|
-
function mergeMap_1(
|
|
699
|
-
return
|
|
727
|
+
function mergeMap_1(f, concurrent = Infinity) {
|
|
728
|
+
return ma => {
|
|
729
|
+
return mergeMapWithIndex_1((_, a) => f(a), concurrent)(ma);
|
|
730
|
+
};
|
|
700
731
|
}
|
|
701
732
|
/**
|
|
702
|
-
* @tsplus
|
|
733
|
+
* @tsplus pipeable fncts.observable.Observable concatMapWithIndex
|
|
703
734
|
*/
|
|
704
735
|
|
|
705
736
|
|
|
706
|
-
export function concatMapWithIndex(
|
|
707
|
-
return
|
|
737
|
+
export function concatMapWithIndex(f) {
|
|
738
|
+
return ma => {
|
|
739
|
+
return mergeMapWithIndex_1(f, 1)(ma);
|
|
740
|
+
};
|
|
708
741
|
}
|
|
709
742
|
/**
|
|
710
|
-
* @tsplus
|
|
743
|
+
* @tsplus pipeable fncts.observable.Observable concatMap
|
|
711
744
|
*/
|
|
712
745
|
|
|
713
|
-
export function
|
|
714
|
-
return
|
|
746
|
+
export function concatMap(f) {
|
|
747
|
+
return ma => {
|
|
748
|
+
return mergeMapWithIndex_1((_, a) => f(a), 1)(ma);
|
|
749
|
+
};
|
|
715
750
|
}
|
|
716
751
|
/**
|
|
717
|
-
* @tsplus
|
|
752
|
+
* @tsplus pipeable fncts.observable.Observable contramapEnvironment
|
|
718
753
|
*/
|
|
719
754
|
|
|
720
|
-
function contramapEnvironment_1(
|
|
721
|
-
return
|
|
755
|
+
function contramapEnvironment_1(f) {
|
|
756
|
+
return self => {
|
|
757
|
+
return environmentWithObservable_1(environment => self.provideEnvironment(f(environment)));
|
|
758
|
+
};
|
|
722
759
|
}
|
|
723
760
|
/**
|
|
724
761
|
* @tsplus getter fncts.observable.Observable flatten
|
|
@@ -729,328 +766,350 @@ export function flatten(mma) {
|
|
|
729
766
|
return concatAll_1(mma);
|
|
730
767
|
}
|
|
731
768
|
/**
|
|
732
|
-
* @tsplus
|
|
769
|
+
* @tsplus pipeable fncts.observable.Observable foldLeftWithIndex
|
|
733
770
|
*/
|
|
734
771
|
|
|
735
|
-
function foldLeftWithIndex_1(
|
|
736
|
-
return
|
|
772
|
+
function foldLeftWithIndex_1(initial, f) {
|
|
773
|
+
return fa => {
|
|
774
|
+
return tsplus_module_8.operate_(scanInternal(f, initial, true, false, true))(fa);
|
|
775
|
+
};
|
|
737
776
|
}
|
|
738
777
|
/**
|
|
739
|
-
* @tsplus
|
|
778
|
+
* @tsplus pipeable fncts.observable.Observable foldLeft
|
|
740
779
|
*/
|
|
741
780
|
|
|
742
781
|
|
|
743
|
-
function foldLeft_1(
|
|
744
|
-
return
|
|
782
|
+
function foldLeft_1(initial, f) {
|
|
783
|
+
return fa => {
|
|
784
|
+
return foldLeftWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
|
|
785
|
+
};
|
|
745
786
|
}
|
|
746
787
|
/**
|
|
747
|
-
* @tsplus
|
|
788
|
+
* @tsplus pipeable fncts.observable.Observable at
|
|
748
789
|
*/
|
|
749
790
|
|
|
750
791
|
|
|
751
|
-
export function
|
|
752
|
-
return
|
|
792
|
+
export function at(index) {
|
|
793
|
+
return fa => {
|
|
794
|
+
return onEmpty_1(() => tsplus_module_17.nothing())(map_1(tsplus_module_17.just)(take_1(1)(filterWithIndex_1(i => i === index)(fa))));
|
|
795
|
+
};
|
|
753
796
|
}
|
|
754
797
|
/**
|
|
755
|
-
* @tsplus
|
|
798
|
+
* @tsplus pipeable fncts.observable.Observable audit
|
|
756
799
|
*/
|
|
757
800
|
|
|
758
|
-
function audit_1(
|
|
759
|
-
return
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
801
|
+
function audit_1(durationSelector) {
|
|
802
|
+
return fa => {
|
|
803
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
804
|
+
let lastValue = tsplus_module_17.nothing();
|
|
805
|
+
let durationSubscriber = null;
|
|
806
|
+
let isComplete = false;
|
|
763
807
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
808
|
+
const endDuration = () => {
|
|
809
|
+
durationSubscriber?.unsubscribe();
|
|
810
|
+
durationSubscriber = null;
|
|
767
811
|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
812
|
+
if (tsplus_module_18.isJust(lastValue)) {
|
|
813
|
+
const {
|
|
814
|
+
value
|
|
815
|
+
} = lastValue;
|
|
816
|
+
lastValue = tsplus_module_17.nothing();
|
|
817
|
+
subscriber.next(value);
|
|
818
|
+
}
|
|
775
819
|
|
|
776
|
-
|
|
777
|
-
|
|
820
|
+
isComplete && subscriber.complete();
|
|
821
|
+
};
|
|
778
822
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
823
|
+
const cleanupDuration = () => {
|
|
824
|
+
durationSubscriber = null;
|
|
825
|
+
isComplete && subscriber.complete();
|
|
826
|
+
};
|
|
783
827
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
828
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
829
|
+
next: value => {
|
|
830
|
+
lastValue = tsplus_module_17.just(value);
|
|
787
831
|
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
832
|
+
if (!durationSubscriber) {
|
|
833
|
+
from_1(durationSelector(value)).provideEnvironment(environment).subscribe(durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
834
|
+
next: endDuration,
|
|
835
|
+
complete: cleanupDuration
|
|
836
|
+
}));
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
complete: () => {
|
|
840
|
+
isComplete = true;
|
|
841
|
+
(tsplus_module_18.isNothing(lastValue) || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();
|
|
793
842
|
}
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
(tsplus_module_18.isNothing(lastValue) || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();
|
|
798
|
-
}
|
|
799
|
-
}));
|
|
800
|
-
});
|
|
843
|
+
}));
|
|
844
|
+
})(fa);
|
|
845
|
+
};
|
|
801
846
|
}
|
|
802
847
|
/**
|
|
803
|
-
* @tsplus
|
|
848
|
+
* @tsplus pipeable fncts.observable.Observable auditTime
|
|
804
849
|
*/
|
|
805
850
|
|
|
806
851
|
|
|
807
|
-
export function
|
|
808
|
-
return
|
|
852
|
+
export function auditTime(duration, scheduler = tsplus_module_5.asyncScheduler) {
|
|
853
|
+
return fa => {
|
|
854
|
+
return audit_1(() => timer_1(duration, scheduler))(fa);
|
|
855
|
+
};
|
|
809
856
|
}
|
|
810
857
|
/**
|
|
811
|
-
* @tsplus
|
|
858
|
+
* @tsplus pipeable fncts.observable.Observable buffer
|
|
812
859
|
*/
|
|
813
860
|
|
|
814
|
-
export function
|
|
815
|
-
return
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
861
|
+
export function buffer(closingNotifier) {
|
|
862
|
+
return fa => {
|
|
863
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
864
|
+
let buffer = [];
|
|
865
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
866
|
+
next: value => buffer.push(value),
|
|
867
|
+
complete: () => {
|
|
868
|
+
subscriber.next(buffer);
|
|
869
|
+
subscriber.complete();
|
|
870
|
+
}
|
|
871
|
+
}));
|
|
872
|
+
closingNotifier.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
873
|
+
next: () => {
|
|
874
|
+
const b = buffer;
|
|
875
|
+
buffer = [];
|
|
876
|
+
subscriber.next(b);
|
|
877
|
+
},
|
|
878
|
+
complete: tsplus_module_2.noop
|
|
879
|
+
}));
|
|
880
|
+
return () => {
|
|
881
|
+
buffer = null;
|
|
882
|
+
};
|
|
883
|
+
})(fa);
|
|
884
|
+
};
|
|
836
885
|
}
|
|
837
886
|
/**
|
|
838
|
-
* @tsplus
|
|
887
|
+
* @tsplus pipeable fncts.observable.Observable bufferCount
|
|
839
888
|
*/
|
|
840
889
|
|
|
841
|
-
export function
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
890
|
+
export function bufferCount(bufferSize, startBufferEvery) {
|
|
891
|
+
return fa => {
|
|
892
|
+
// eslint-disable-next-line no-param-reassign
|
|
893
|
+
startBufferEvery = startBufferEvery ?? bufferSize;
|
|
894
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
895
|
+
let buffers = [];
|
|
896
|
+
let count = 0;
|
|
897
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
898
|
+
next: value => {
|
|
899
|
+
let toEmit = null;
|
|
850
900
|
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
901
|
+
if (count++ % startBufferEvery === 0) {
|
|
902
|
+
buffers.push([]);
|
|
903
|
+
}
|
|
854
904
|
|
|
855
|
-
|
|
856
|
-
|
|
905
|
+
for (const buffer of buffers) {
|
|
906
|
+
buffer.push(value);
|
|
857
907
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
908
|
+
if (bufferSize <= buffer.length) {
|
|
909
|
+
toEmit = toEmit ?? [];
|
|
910
|
+
toEmit.push(buffer);
|
|
911
|
+
}
|
|
861
912
|
}
|
|
862
|
-
}
|
|
863
913
|
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
914
|
+
if (toEmit) {
|
|
915
|
+
for (const buffer of toEmit) {
|
|
916
|
+
arrayRemove(buffers, buffer);
|
|
917
|
+
subscriber.next(buffer);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
},
|
|
921
|
+
complete: () => {
|
|
922
|
+
for (const buffer of buffers) {
|
|
867
923
|
subscriber.next(buffer);
|
|
868
924
|
}
|
|
869
|
-
}
|
|
870
|
-
},
|
|
871
|
-
complete: () => {
|
|
872
|
-
for (const buffer of buffers) {
|
|
873
|
-
subscriber.next(buffer);
|
|
874
|
-
}
|
|
875
925
|
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
926
|
+
subscriber.complete();
|
|
927
|
+
}
|
|
928
|
+
}, () => {
|
|
929
|
+
buffers = null;
|
|
930
|
+
}));
|
|
931
|
+
})(fa);
|
|
932
|
+
};
|
|
882
933
|
}
|
|
883
934
|
/**
|
|
884
|
-
* @tsplus
|
|
935
|
+
* @tsplus pipeable fncts.observable.Observable bufferTime
|
|
885
936
|
*/
|
|
886
937
|
|
|
887
|
-
export function
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
const {
|
|
900
|
-
|
|
901
|
-
subs
|
|
902
|
-
} = record;
|
|
903
|
-
subs.unsubscribe();
|
|
904
|
-
arrayRemove(bufferRecords, record);
|
|
905
|
-
subscriber.next(buffer);
|
|
906
|
-
restartOnEmit && startBuffer();
|
|
907
|
-
};
|
|
908
|
-
|
|
909
|
-
const startBuffer = () => {
|
|
910
|
-
if (bufferRecords) {
|
|
911
|
-
const subs = new tsplus_module_6.Subscription();
|
|
912
|
-
subscriber.add(subs);
|
|
913
|
-
const buffer = [];
|
|
914
|
-
const record = {
|
|
938
|
+
export function bufferTime(config) {
|
|
939
|
+
return fa => {
|
|
940
|
+
const {
|
|
941
|
+
bufferTimeSpan,
|
|
942
|
+
bufferCreationInterval = null,
|
|
943
|
+
maxBufferSize = Infinity,
|
|
944
|
+
scheduler = tsplus_module_5.asyncScheduler
|
|
945
|
+
} = config;
|
|
946
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
947
|
+
let bufferRecords = [];
|
|
948
|
+
let restartOnEmit = true;
|
|
949
|
+
|
|
950
|
+
const emit = record => {
|
|
951
|
+
const {
|
|
915
952
|
buffer,
|
|
916
953
|
subs
|
|
917
|
-
};
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
954
|
+
} = record;
|
|
955
|
+
subs.unsubscribe();
|
|
956
|
+
arrayRemove(bufferRecords, record);
|
|
957
|
+
subscriber.next(buffer);
|
|
958
|
+
restartOnEmit && startBuffer();
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
const startBuffer = () => {
|
|
962
|
+
if (bufferRecords) {
|
|
963
|
+
const subs = new tsplus_module_6.Subscription();
|
|
964
|
+
subscriber.add(subs);
|
|
965
|
+
const buffer = [];
|
|
966
|
+
const record = {
|
|
967
|
+
buffer,
|
|
968
|
+
subs
|
|
969
|
+
};
|
|
970
|
+
bufferRecords.push(record);
|
|
971
|
+
subs.add(scheduler.schedule(() => emit(record), bufferTimeSpan));
|
|
972
|
+
}
|
|
973
|
+
};
|
|
922
974
|
|
|
923
|
-
|
|
975
|
+
bufferCreationInterval !== null && bufferCreationInterval >= 0 ? subscriber.add(scheduler.schedule(function () {
|
|
976
|
+
startBuffer();
|
|
977
|
+
!this.closed && subscriber.add(this.schedule(null, bufferCreationInterval));
|
|
978
|
+
}, bufferCreationInterval)) : restartOnEmit = true;
|
|
924
979
|
startBuffer();
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
980
|
+
const bufferTimeSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
981
|
+
next: value => {
|
|
982
|
+
const recordsCopy = bufferRecords.slice();
|
|
983
|
+
|
|
984
|
+
for (const record of recordsCopy) {
|
|
985
|
+
const {
|
|
986
|
+
buffer
|
|
987
|
+
} = record;
|
|
988
|
+
buffer.push(value);
|
|
989
|
+
maxBufferSize <= buffer.length && emit(record);
|
|
990
|
+
}
|
|
991
|
+
},
|
|
992
|
+
complete: () => {
|
|
993
|
+
while (bufferRecords?.length) {
|
|
994
|
+
subscriber.next(bufferRecords.shift().buffer);
|
|
995
|
+
}
|
|
931
996
|
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
} = record;
|
|
936
|
-
buffer.push(value);
|
|
937
|
-
maxBufferSize <= buffer.length && emit(record);
|
|
938
|
-
}
|
|
939
|
-
},
|
|
940
|
-
complete: () => {
|
|
941
|
-
while (bufferRecords?.length) {
|
|
942
|
-
subscriber.next(bufferRecords.shift().buffer);
|
|
997
|
+
bufferTimeSubscriber?.unsubscribe();
|
|
998
|
+
subscriber.complete();
|
|
999
|
+
subscriber.unsubscribe();
|
|
943
1000
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
}
|
|
949
|
-
}, () => bufferRecords = null);
|
|
950
|
-
source.subscribe(bufferTimeSubscriber);
|
|
951
|
-
});
|
|
1001
|
+
}, () => bufferRecords = null);
|
|
1002
|
+
source.provideEnvironment(environment).subscribe(bufferTimeSubscriber);
|
|
1003
|
+
})(fa);
|
|
1004
|
+
};
|
|
952
1005
|
}
|
|
953
1006
|
/**
|
|
954
|
-
* @tsplus
|
|
1007
|
+
* @tsplus pipeable fncts.observable.Observable bufferToggle
|
|
955
1008
|
*/
|
|
956
1009
|
|
|
957
|
-
export function
|
|
958
|
-
return
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1010
|
+
export function bufferToggle(openings, closingSelector) {
|
|
1011
|
+
return fa => {
|
|
1012
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1013
|
+
const buffers = [];
|
|
1014
|
+
from_1(openings).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1015
|
+
next: openValue => {
|
|
1016
|
+
const buffer = [];
|
|
1017
|
+
buffers.push(buffer);
|
|
1018
|
+
const closingSubscription = new tsplus_module_6.Subscription();
|
|
965
1019
|
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1020
|
+
const emitBuffer = () => {
|
|
1021
|
+
arrayRemove(buffers, buffer);
|
|
1022
|
+
subscriber.next(buffer);
|
|
1023
|
+
closingSubscription.unsubscribe();
|
|
1024
|
+
};
|
|
971
1025
|
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1026
|
+
closingSubscription.add(from_1(closingSelector(openValue)).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1027
|
+
next: emitBuffer,
|
|
1028
|
+
complete: tsplus_module_2.noop
|
|
1029
|
+
})));
|
|
1030
|
+
},
|
|
1031
|
+
complete: tsplus_module_2.noop
|
|
1032
|
+
}));
|
|
1033
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1034
|
+
next: value => {
|
|
1035
|
+
for (const buffer of buffers) {
|
|
1036
|
+
buffer.push(value);
|
|
1037
|
+
}
|
|
1038
|
+
},
|
|
1039
|
+
complete: () => {
|
|
1040
|
+
while (buffers.length > 0) {
|
|
1041
|
+
subscriber.next(buffers.shift());
|
|
1042
|
+
}
|
|
989
1043
|
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1044
|
+
subscriber.complete();
|
|
1045
|
+
}
|
|
1046
|
+
}));
|
|
1047
|
+
})(fa);
|
|
1048
|
+
};
|
|
994
1049
|
}
|
|
995
1050
|
/**
|
|
996
|
-
* @tsplus
|
|
1051
|
+
* @tsplus pipeable fncts.observable.Observable bufferWhen
|
|
997
1052
|
*/
|
|
998
1053
|
|
|
999
|
-
export function
|
|
1000
|
-
return
|
|
1001
|
-
|
|
1002
|
-
|
|
1054
|
+
export function bufferWhen(closingSelector) {
|
|
1055
|
+
return fa => {
|
|
1056
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1057
|
+
let buffer = null;
|
|
1058
|
+
let closingSubscriber = null;
|
|
1003
1059
|
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1060
|
+
const openBuffer = () => {
|
|
1061
|
+
closingSubscriber?.unsubscribe();
|
|
1062
|
+
const b = buffer;
|
|
1063
|
+
buffer = [];
|
|
1064
|
+
b && subscriber.next(b);
|
|
1065
|
+
from_1(closingSelector()).provideEnvironment(environment).subscribe(closingSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1066
|
+
next: openBuffer,
|
|
1067
|
+
complete: tsplus_module_2.noop
|
|
1068
|
+
}));
|
|
1069
|
+
};
|
|
1014
1070
|
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1071
|
+
openBuffer();
|
|
1072
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1073
|
+
next: value => buffer?.push(value),
|
|
1074
|
+
complete: () => {
|
|
1075
|
+
buffer && subscriber.next(buffer);
|
|
1076
|
+
subscriber.complete();
|
|
1077
|
+
}
|
|
1078
|
+
}, () => buffer = closingSubscriber = null));
|
|
1079
|
+
})(fa);
|
|
1080
|
+
};
|
|
1024
1081
|
}
|
|
1025
1082
|
/**
|
|
1026
|
-
* @tsplus
|
|
1083
|
+
* @tsplus pipeable fncts.observable.Observable catchAllCause
|
|
1027
1084
|
*/
|
|
1028
1085
|
|
|
1029
|
-
function catchAllCause_1(
|
|
1030
|
-
return
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
innerSub
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1086
|
+
function catchAllCause_1(f) {
|
|
1087
|
+
return self => {
|
|
1088
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1089
|
+
let innerSub = null;
|
|
1090
|
+
let syncUnsub = false;
|
|
1091
|
+
let handledResult;
|
|
1092
|
+
innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1093
|
+
error: cause => {
|
|
1094
|
+
handledResult = from_1(f(cause, catchAllCause_1(f)(source)));
|
|
1095
|
+
|
|
1096
|
+
if (innerSub) {
|
|
1097
|
+
innerSub.unsubscribe();
|
|
1098
|
+
innerSub = null;
|
|
1099
|
+
handledResult.provideEnvironment(environment).subscribe(subscriber);
|
|
1100
|
+
} else {
|
|
1101
|
+
syncUnsub = true;
|
|
1102
|
+
}
|
|
1044
1103
|
}
|
|
1045
|
-
}
|
|
1046
|
-
}));
|
|
1104
|
+
}));
|
|
1047
1105
|
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1106
|
+
if (syncUnsub) {
|
|
1107
|
+
innerSub.unsubscribe();
|
|
1108
|
+
innerSub = null;
|
|
1109
|
+
handledResult.provideEnvironment(environment).subscribe(subscriber);
|
|
1110
|
+
}
|
|
1111
|
+
})(self);
|
|
1112
|
+
};
|
|
1054
1113
|
}
|
|
1055
1114
|
/**
|
|
1056
1115
|
* @tsplus getter fncts.observable.Observable concatAll
|
|
@@ -1058,17 +1117,19 @@ function catchAllCause_1(self, f) {
|
|
|
1058
1117
|
|
|
1059
1118
|
|
|
1060
1119
|
function concatAll_1(ffa) {
|
|
1061
|
-
return mergeAll_1(
|
|
1120
|
+
return mergeAll_1(1)(ffa);
|
|
1062
1121
|
}
|
|
1063
1122
|
/**
|
|
1064
|
-
* @tsplus
|
|
1123
|
+
* @tsplus pipeable fncts.observable.Observable concat
|
|
1065
1124
|
*/
|
|
1066
1125
|
|
|
1067
1126
|
|
|
1068
|
-
function concat_1(
|
|
1069
|
-
return
|
|
1070
|
-
|
|
1071
|
-
|
|
1127
|
+
function concat_1(...sources) {
|
|
1128
|
+
return fa => {
|
|
1129
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1130
|
+
concatAll_1(fromArrayLike([source, ...sources])).provideEnvironment(environment).subscribe(subscriber);
|
|
1131
|
+
})(fa);
|
|
1132
|
+
};
|
|
1072
1133
|
}
|
|
1073
1134
|
/**
|
|
1074
1135
|
* @tsplus getter fncts.observable.Observable count
|
|
@@ -1076,210 +1137,237 @@ function concat_1(fa, ...sources) {
|
|
|
1076
1137
|
|
|
1077
1138
|
|
|
1078
1139
|
export function count(fa) {
|
|
1079
|
-
return foldLeft_1(
|
|
1140
|
+
return foldLeft_1(0, (total, _) => total + 1)(fa);
|
|
1080
1141
|
}
|
|
1081
1142
|
/**
|
|
1082
|
-
* @tsplus
|
|
1143
|
+
* @tsplus pipeable fncts.observable.Observable countWithIndex
|
|
1083
1144
|
*/
|
|
1084
1145
|
|
|
1085
|
-
function countWithIndex_1(
|
|
1086
|
-
return
|
|
1146
|
+
function countWithIndex_1(predicate) {
|
|
1147
|
+
return fa => {
|
|
1148
|
+
return foldLeftWithIndex_1(0, (i, total, v) => predicate(i, v) ? total + 1 : total)(fa);
|
|
1149
|
+
};
|
|
1087
1150
|
}
|
|
1088
1151
|
/**
|
|
1089
|
-
* @tsplus
|
|
1152
|
+
* @tsplus pipeable fncts.observable.Observable countWith
|
|
1090
1153
|
*/
|
|
1091
1154
|
|
|
1092
1155
|
|
|
1093
|
-
export function
|
|
1094
|
-
return
|
|
1156
|
+
export function countWith(predicate) {
|
|
1157
|
+
return fa => {
|
|
1158
|
+
return countWithIndex_1((_, a) => predicate(a))(fa);
|
|
1159
|
+
};
|
|
1095
1160
|
}
|
|
1096
1161
|
/**
|
|
1097
1162
|
* @tsplus getter fncts.observable.Observable combineLatestAll
|
|
1098
1163
|
*/
|
|
1099
1164
|
|
|
1100
1165
|
export function combineLatestAll(fa) {
|
|
1101
|
-
return joinAllInternal(fa, sources => !sources.length ? empty_1() :
|
|
1166
|
+
return joinAllInternal(fa, sources => !sources.length ? empty_1() : zipLatest_1(sources[0], ...sources.slice(1)));
|
|
1102
1167
|
}
|
|
1103
1168
|
/**
|
|
1104
|
-
* @tsplus
|
|
1169
|
+
* @tsplus pipeable fncts.observable.Observable zipLatest
|
|
1105
1170
|
*/
|
|
1106
1171
|
|
|
1107
|
-
function
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1172
|
+
function zipLatest_1(...sources) {
|
|
1173
|
+
return self => {
|
|
1174
|
+
if (!sources.length) {
|
|
1175
|
+
return from_1(self).unsafeCoerce();
|
|
1176
|
+
}
|
|
1111
1177
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1178
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1179
|
+
combineLatestInternal(subscriber, environment, [source, ...sources]);
|
|
1180
|
+
})(from_1(self));
|
|
1181
|
+
};
|
|
1115
1182
|
}
|
|
1116
1183
|
/**
|
|
1117
|
-
* @tsplus
|
|
1184
|
+
* @tsplus pipeable fncts.observable.Observable zipWithLatest
|
|
1118
1185
|
*/
|
|
1119
1186
|
|
|
1120
1187
|
|
|
1121
|
-
export function
|
|
1122
|
-
return
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
const emit = () => {
|
|
1127
|
-
durationSubscriber?.unsubscribe();
|
|
1128
|
-
durationSubscriber = null;
|
|
1129
|
-
|
|
1130
|
-
if (tsplus_module_18.isJust(lastValue)) {
|
|
1131
|
-
const {
|
|
1132
|
-
value
|
|
1133
|
-
} = lastValue;
|
|
1134
|
-
lastValue = tsplus_module_17.nothing();
|
|
1135
|
-
subscriber.next(value);
|
|
1136
|
-
}
|
|
1137
|
-
};
|
|
1138
|
-
|
|
1139
|
-
source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1140
|
-
next: value => {
|
|
1141
|
-
durationSubscriber?.unsubscribe();
|
|
1142
|
-
lastValue = tsplus_module_17.just(value);
|
|
1143
|
-
durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1144
|
-
next: emit,
|
|
1145
|
-
complete: tsplus_module_2.noop
|
|
1146
|
-
});
|
|
1147
|
-
from_1(durationSelector(value)).subscribe(durationSubscriber);
|
|
1148
|
-
},
|
|
1149
|
-
complete: () => {
|
|
1150
|
-
emit();
|
|
1151
|
-
subscriber.complete();
|
|
1152
|
-
}
|
|
1153
|
-
}, () => {
|
|
1154
|
-
lastValue = durationSubscriber = null;
|
|
1155
|
-
}));
|
|
1156
|
-
});
|
|
1188
|
+
export function zipWithLatest(that, f) {
|
|
1189
|
+
return self => {
|
|
1190
|
+
return map_1(tsplus_module_13.tupled(f))(zipLatest_1(from_1(that))(self));
|
|
1191
|
+
};
|
|
1157
1192
|
}
|
|
1158
1193
|
/**
|
|
1159
|
-
* @tsplus
|
|
1194
|
+
* @tsplus pipeable fncts.observable.Observable debounceWith
|
|
1160
1195
|
*/
|
|
1161
1196
|
|
|
1162
|
-
export function
|
|
1163
|
-
return
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1197
|
+
export function debounceWith(durationSelector) {
|
|
1198
|
+
return fa => {
|
|
1199
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1200
|
+
let lastValue = tsplus_module_17.nothing();
|
|
1201
|
+
let durationSubscriber = null;
|
|
1167
1202
|
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
activeTask = null;
|
|
1172
|
-
const value = lastValue;
|
|
1173
|
-
lastValue = null;
|
|
1174
|
-
subscriber.next(value);
|
|
1175
|
-
}
|
|
1176
|
-
};
|
|
1203
|
+
const emit = () => {
|
|
1204
|
+
durationSubscriber?.unsubscribe();
|
|
1205
|
+
durationSubscriber = null;
|
|
1177
1206
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1207
|
+
if (tsplus_module_18.isJust(lastValue)) {
|
|
1208
|
+
const {
|
|
1209
|
+
value
|
|
1210
|
+
} = lastValue;
|
|
1211
|
+
lastValue = tsplus_module_17.nothing();
|
|
1212
|
+
subscriber.next(value);
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1181
1215
|
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1216
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1217
|
+
next: value => {
|
|
1218
|
+
durationSubscriber?.unsubscribe();
|
|
1219
|
+
lastValue = tsplus_module_17.just(value);
|
|
1220
|
+
durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1221
|
+
next: emit,
|
|
1222
|
+
complete: tsplus_module_2.noop
|
|
1223
|
+
});
|
|
1224
|
+
from_1(durationSelector(value)).provideEnvironment(environment).subscribe(durationSubscriber);
|
|
1225
|
+
},
|
|
1226
|
+
complete: () => {
|
|
1227
|
+
emit();
|
|
1228
|
+
subscriber.complete();
|
|
1229
|
+
}
|
|
1230
|
+
}, () => {
|
|
1231
|
+
lastValue = durationSubscriber = null;
|
|
1232
|
+
}));
|
|
1233
|
+
})(fa);
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* @tsplus pipeable fncts.observable.Observable debounce
|
|
1238
|
+
*/
|
|
1187
1239
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1240
|
+
export function debounce(dueTime, scheduler = tsplus_module_5.asyncScheduler) {
|
|
1241
|
+
return fa => {
|
|
1242
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1243
|
+
let activeTask = null;
|
|
1244
|
+
let lastValue = null;
|
|
1245
|
+
let lastTime = null;
|
|
1190
1246
|
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1247
|
+
const emit = () => {
|
|
1248
|
+
if (activeTask) {
|
|
1249
|
+
activeTask.unsubscribe();
|
|
1250
|
+
activeTask = null;
|
|
1251
|
+
const value = lastValue;
|
|
1252
|
+
lastValue = null;
|
|
1253
|
+
subscriber.next(value);
|
|
1254
|
+
}
|
|
1255
|
+
};
|
|
1195
1256
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1257
|
+
function emitWhenIdle() {
|
|
1258
|
+
const targetTime = lastTime + dueTime;
|
|
1259
|
+
const now = scheduler.now();
|
|
1260
|
+
|
|
1261
|
+
if (now < targetTime) {
|
|
1262
|
+
activeTask = this.schedule(undefined, targetTime - now);
|
|
1198
1263
|
subscriber.add(activeTask);
|
|
1264
|
+
return;
|
|
1199
1265
|
}
|
|
1200
|
-
|
|
1201
|
-
complete: () => {
|
|
1266
|
+
|
|
1202
1267
|
emit();
|
|
1203
|
-
subscriber.complete();
|
|
1204
1268
|
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1269
|
+
|
|
1270
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1271
|
+
next: value => {
|
|
1272
|
+
lastValue = value;
|
|
1273
|
+
lastTime = scheduler.now();
|
|
1274
|
+
|
|
1275
|
+
if (!activeTask) {
|
|
1276
|
+
activeTask = scheduler.schedule(emitWhenIdle, dueTime);
|
|
1277
|
+
subscriber.add(activeTask);
|
|
1278
|
+
}
|
|
1279
|
+
},
|
|
1280
|
+
complete: () => {
|
|
1281
|
+
emit();
|
|
1282
|
+
subscriber.complete();
|
|
1283
|
+
}
|
|
1284
|
+
}, () => {
|
|
1285
|
+
lastValue = activeTask = null;
|
|
1286
|
+
}));
|
|
1287
|
+
})(fa);
|
|
1288
|
+
};
|
|
1209
1289
|
}
|
|
1210
1290
|
/**
|
|
1211
1291
|
* @tsplus getter fncts.observable.Observable either
|
|
1212
1292
|
*/
|
|
1213
1293
|
|
|
1214
1294
|
export function either(fa) {
|
|
1215
|
-
return tsplus_module_8.operate_(
|
|
1216
|
-
source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1295
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1296
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1217
1297
|
next: value => {
|
|
1218
1298
|
subscriber.next(tsplus_module_19.right(value));
|
|
1219
1299
|
},
|
|
1220
1300
|
error: error => {
|
|
1221
|
-
tsplus_module_14.
|
|
1301
|
+
tsplus_module_14.match(e => subscriber.next(tsplus_module_19.left(e)), cause => subscriber.error(cause))(tsplus_module_1.failureOrCause(error));
|
|
1222
1302
|
}
|
|
1223
1303
|
}));
|
|
1224
|
-
});
|
|
1304
|
+
})(fa);
|
|
1225
1305
|
}
|
|
1226
1306
|
/**
|
|
1227
|
-
* @tsplus
|
|
1307
|
+
* @tsplus pipeable fncts.observable.Observable delayWithIndex
|
|
1228
1308
|
*/
|
|
1229
1309
|
|
|
1230
|
-
function delayWithIndex_1(
|
|
1231
|
-
return
|
|
1310
|
+
function delayWithIndex_1(f) {
|
|
1311
|
+
return fa => {
|
|
1312
|
+
return mergeMapWithIndex_1((i, a) => as_1(() => a)(take_1(1)(f(i, a))))(fa);
|
|
1313
|
+
};
|
|
1232
1314
|
}
|
|
1233
1315
|
/**
|
|
1234
|
-
* @tsplus
|
|
1316
|
+
* @tsplus pipeable fncts.observable.Observable delayWith
|
|
1235
1317
|
*/
|
|
1236
1318
|
|
|
1237
1319
|
|
|
1238
|
-
function delayWith_1(
|
|
1239
|
-
return
|
|
1320
|
+
function delayWith_1(f) {
|
|
1321
|
+
return fa => {
|
|
1322
|
+
return delayWithIndex_1((_, a) => f(a))(fa);
|
|
1323
|
+
};
|
|
1240
1324
|
}
|
|
1241
1325
|
/**
|
|
1242
|
-
* @tsplus
|
|
1326
|
+
* @tsplus pipeable fncts.observable.Observable delay
|
|
1243
1327
|
*/
|
|
1244
1328
|
|
|
1245
1329
|
|
|
1246
|
-
export function
|
|
1247
|
-
|
|
1248
|
-
|
|
1330
|
+
export function delay(due, scheduler = tsplus_module_5.asyncScheduler) {
|
|
1331
|
+
return fa => {
|
|
1332
|
+
const duration = timer_1(due, scheduler);
|
|
1333
|
+
return delayWith_1(() => duration)(fa);
|
|
1334
|
+
};
|
|
1249
1335
|
}
|
|
1250
1336
|
/**
|
|
1251
1337
|
* @tsplus getter fncts.observable.Observable dematerialize
|
|
1252
1338
|
*/
|
|
1253
1339
|
|
|
1254
1340
|
export function dematerialize(fa) {
|
|
1255
|
-
return tsplus_module_8.operate_(
|
|
1256
|
-
source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1257
|
-
next: notification => tsplus_module_20.
|
|
1341
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1342
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1343
|
+
next: notification => tsplus_module_20.observe(subscriber)(notification)
|
|
1258
1344
|
}));
|
|
1259
|
-
});
|
|
1345
|
+
})(fa);
|
|
1260
1346
|
}
|
|
1261
1347
|
/**
|
|
1262
|
-
* @tsplus
|
|
1348
|
+
* @tsplus pipeable fncts.observable.Observable ensuring
|
|
1263
1349
|
*/
|
|
1264
1350
|
|
|
1265
|
-
export function
|
|
1266
|
-
return
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1351
|
+
export function ensuring(finalizer) {
|
|
1352
|
+
return fa => {
|
|
1353
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1354
|
+
source.provideEnvironment(environment).subscribe(subscriber);
|
|
1355
|
+
subscriber.add(finalizer);
|
|
1356
|
+
})(fa);
|
|
1357
|
+
};
|
|
1270
1358
|
}
|
|
1271
1359
|
/**
|
|
1272
1360
|
* @tsplus getter fncts.observable.Observable exhaustAll
|
|
1273
1361
|
*/
|
|
1274
1362
|
|
|
1275
1363
|
export function exhaustAll(ffa) {
|
|
1276
|
-
return tsplus_module_8.operate_(
|
|
1364
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1277
1365
|
let isComplete = false;
|
|
1278
1366
|
let innerSub = null;
|
|
1279
|
-
source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1367
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1280
1368
|
next: inner => {
|
|
1281
1369
|
if (!innerSub) {
|
|
1282
|
-
innerSub = from_1(inner).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1370
|
+
innerSub = from_1(inner).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1283
1371
|
complete: () => {
|
|
1284
1372
|
innerSub = null;
|
|
1285
1373
|
isComplete && subscriber.complete();
|
|
@@ -1292,76 +1380,91 @@ export function exhaustAll(ffa) {
|
|
|
1292
1380
|
!innerSub && subscriber.complete();
|
|
1293
1381
|
}
|
|
1294
1382
|
}));
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1297
|
-
/**
|
|
1298
|
-
* @tsplus
|
|
1299
|
-
*/
|
|
1300
|
-
|
|
1301
|
-
function exhaustMapWithIndex_1(
|
|
1302
|
-
return
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1383
|
+
})(ffa);
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* @tsplus pipeable fncts.observable.Observable exhaustMapWithIndex
|
|
1387
|
+
*/
|
|
1388
|
+
|
|
1389
|
+
function exhaustMapWithIndex_1(f) {
|
|
1390
|
+
return self => {
|
|
1391
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1392
|
+
let index = 0;
|
|
1393
|
+
let innerSub = null;
|
|
1394
|
+
let isComplete = false;
|
|
1395
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1396
|
+
next: outerValue => {
|
|
1397
|
+
if (!innerSub) {
|
|
1398
|
+
innerSub = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1399
|
+
complete: () => {
|
|
1400
|
+
innerSub = null;
|
|
1401
|
+
isComplete && subscriber.complete();
|
|
1402
|
+
}
|
|
1403
|
+
});
|
|
1404
|
+
from_1(f(index++, outerValue)).provideEnvironment(environment).subscribe(innerSub);
|
|
1405
|
+
}
|
|
1406
|
+
},
|
|
1407
|
+
complete: () => {
|
|
1408
|
+
isComplete = true;
|
|
1409
|
+
!innerSub && subscriber.complete();
|
|
1316
1410
|
}
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
!innerSub && subscriber.complete();
|
|
1321
|
-
}
|
|
1322
|
-
}));
|
|
1323
|
-
});
|
|
1411
|
+
}));
|
|
1412
|
+
})(self);
|
|
1413
|
+
};
|
|
1324
1414
|
}
|
|
1325
1415
|
/**
|
|
1326
|
-
* @tsplus
|
|
1416
|
+
* @tsplus pipeable fncts.observable.Observable exhaustMap
|
|
1327
1417
|
*/
|
|
1328
1418
|
|
|
1329
1419
|
|
|
1330
|
-
export function
|
|
1331
|
-
return
|
|
1420
|
+
export function exhaustMap(f) {
|
|
1421
|
+
return self => {
|
|
1422
|
+
return exhaustMapWithIndex_1((_, a) => f(a))(self);
|
|
1423
|
+
};
|
|
1332
1424
|
}
|
|
1333
1425
|
/**
|
|
1334
|
-
* @tsplus
|
|
1426
|
+
* @tsplus pipeable fncts.observable.Observable expandWithIndex
|
|
1335
1427
|
*/
|
|
1336
1428
|
|
|
1337
|
-
function expandWithIndex_1(
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1429
|
+
function expandWithIndex_1(f, concurrent = Infinity) {
|
|
1430
|
+
return fa => {
|
|
1431
|
+
concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
|
|
1432
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => mergeInternal(source, subscriber, environment, f, concurrent, undefined, true))(fa);
|
|
1433
|
+
};
|
|
1341
1434
|
}
|
|
1342
1435
|
/**
|
|
1343
|
-
* @tsplus
|
|
1436
|
+
* @tsplus pipeable fncts.observable.Observable expand
|
|
1344
1437
|
*/
|
|
1345
1438
|
|
|
1346
1439
|
|
|
1347
|
-
export function
|
|
1348
|
-
return
|
|
1440
|
+
export function expand(f, concurrent = Infinity) {
|
|
1441
|
+
return fa => {
|
|
1442
|
+
return expandWithIndex_1((_, a) => f(a), concurrent)(fa);
|
|
1443
|
+
};
|
|
1349
1444
|
}
|
|
1350
1445
|
|
|
1351
|
-
function findWithIndex_1(
|
|
1352
|
-
return
|
|
1446
|
+
function findWithIndex_1(predicate) {
|
|
1447
|
+
return fa => {
|
|
1448
|
+
return tsplus_module_8.operate_(findInternal(predicate, "value"))(fa);
|
|
1449
|
+
};
|
|
1353
1450
|
}
|
|
1354
1451
|
|
|
1355
|
-
export function
|
|
1356
|
-
return
|
|
1452
|
+
export function find(predicate) {
|
|
1453
|
+
return fa => {
|
|
1454
|
+
return findWithIndex_1((_, a) => predicate(a))(fa);
|
|
1455
|
+
};
|
|
1357
1456
|
}
|
|
1358
1457
|
|
|
1359
|
-
function findIndexWithIndex_1(
|
|
1360
|
-
return
|
|
1458
|
+
function findIndexWithIndex_1(predicate) {
|
|
1459
|
+
return fa => {
|
|
1460
|
+
return tsplus_module_8.operate_(findInternal(predicate, "index"))(fa);
|
|
1461
|
+
};
|
|
1361
1462
|
}
|
|
1362
1463
|
|
|
1363
|
-
export function
|
|
1364
|
-
return
|
|
1464
|
+
export function findIndex(predicate) {
|
|
1465
|
+
return fa => {
|
|
1466
|
+
return findIndexWithIndex_1((_, a) => predicate(a))(fa);
|
|
1467
|
+
};
|
|
1365
1468
|
}
|
|
1366
1469
|
export function forkJoin(...args) {
|
|
1367
1470
|
const {
|
|
@@ -1412,19 +1515,19 @@ export function forkJoin(...args) {
|
|
|
1412
1515
|
*/
|
|
1413
1516
|
|
|
1414
1517
|
export function ignore(fa) {
|
|
1415
|
-
return tsplus_module_8.operate_(
|
|
1416
|
-
source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1518
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1519
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1417
1520
|
next: tsplus_module_2.noop
|
|
1418
1521
|
}));
|
|
1419
|
-
});
|
|
1522
|
+
})(fa);
|
|
1420
1523
|
}
|
|
1421
1524
|
/**
|
|
1422
1525
|
* @tsplus getter fncts.observable.Observable isEmpty
|
|
1423
1526
|
*/
|
|
1424
1527
|
|
|
1425
1528
|
export function isEmpty(fa) {
|
|
1426
|
-
return tsplus_module_8.operate_(
|
|
1427
|
-
source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1529
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1530
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1428
1531
|
next: () => {
|
|
1429
1532
|
subscriber.next(false);
|
|
1430
1533
|
subscriber.complete();
|
|
@@ -1434,15 +1537,15 @@ export function isEmpty(fa) {
|
|
|
1434
1537
|
subscriber.complete();
|
|
1435
1538
|
}
|
|
1436
1539
|
}));
|
|
1437
|
-
});
|
|
1540
|
+
})(fa);
|
|
1438
1541
|
}
|
|
1439
1542
|
/**
|
|
1440
1543
|
* @tsplus getter fncts.observable.Observable materialize
|
|
1441
1544
|
*/
|
|
1442
1545
|
|
|
1443
1546
|
export function materialize(fa) {
|
|
1444
|
-
return tsplus_module_8.operate_(
|
|
1445
|
-
source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1547
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1548
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1446
1549
|
next: value => {
|
|
1447
1550
|
subscriber.next(tsplus_module_20.next(value));
|
|
1448
1551
|
},
|
|
@@ -1453,38 +1556,44 @@ export function materialize(fa) {
|
|
|
1453
1556
|
subscriber.next(tsplus_module_20.complete());
|
|
1454
1557
|
}
|
|
1455
1558
|
}));
|
|
1456
|
-
});
|
|
1559
|
+
})(fa);
|
|
1457
1560
|
}
|
|
1458
1561
|
/**
|
|
1459
|
-
* @tsplus
|
|
1562
|
+
* @tsplus pipeable fncts.observable.Observable mergeAll
|
|
1460
1563
|
*/
|
|
1461
1564
|
|
|
1462
|
-
function mergeAll_1(
|
|
1463
|
-
return
|
|
1565
|
+
function mergeAll_1(concurrent = Infinity) {
|
|
1566
|
+
return self => {
|
|
1567
|
+
return mergeMap_1(tsplus_module_13.identity, concurrent)(self);
|
|
1568
|
+
};
|
|
1464
1569
|
}
|
|
1465
1570
|
/**
|
|
1466
|
-
* @tsplus
|
|
1571
|
+
* @tsplus pipeable fncts.observable.Observable mergeScanWithIndex
|
|
1467
1572
|
*/
|
|
1468
1573
|
|
|
1469
1574
|
|
|
1470
|
-
function mergeScanWithIndex_1(
|
|
1471
|
-
return
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
state
|
|
1475
|
-
|
|
1476
|
-
|
|
1575
|
+
function mergeScanWithIndex_1(initial, f, concurrent = Infinity) {
|
|
1576
|
+
return fa => {
|
|
1577
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1578
|
+
let state = initial;
|
|
1579
|
+
return mergeInternal(source, subscriber, environment, (index, value) => f(index, state, value), concurrent, value => {
|
|
1580
|
+
state = value;
|
|
1581
|
+
}, false, undefined, () => state = null);
|
|
1582
|
+
})(fa);
|
|
1583
|
+
};
|
|
1477
1584
|
}
|
|
1478
1585
|
/**
|
|
1479
|
-
* @tsplus
|
|
1586
|
+
* @tsplus pipeable fncts.observable.Observable mergeScan
|
|
1480
1587
|
*/
|
|
1481
1588
|
|
|
1482
1589
|
|
|
1483
|
-
export function
|
|
1484
|
-
return
|
|
1590
|
+
export function mergeScan(initial, f, concurrent = Infinity) {
|
|
1591
|
+
return fa => {
|
|
1592
|
+
return mergeScanWithIndex_1(initial, (_, b, a) => f(b, a), concurrent)(fa);
|
|
1593
|
+
};
|
|
1485
1594
|
}
|
|
1486
1595
|
export function onErrorResumeNext(fa, ...sources) {
|
|
1487
|
-
return tsplus_module_8.operate_(
|
|
1596
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1488
1597
|
const remaining = [source, ...sources];
|
|
1489
1598
|
|
|
1490
1599
|
const subscribeNext = () => {
|
|
@@ -1503,7 +1612,7 @@ export function onErrorResumeNext(fa, ...sources) {
|
|
|
1503
1612
|
error: tsplus_module_2.noop,
|
|
1504
1613
|
complete: tsplus_module_2.noop
|
|
1505
1614
|
});
|
|
1506
|
-
subscriber.add(nextSource.subscribe(innerSub));
|
|
1615
|
+
subscriber.add(nextSource.provideEnvironment(environment).subscribe(innerSub));
|
|
1507
1616
|
innerSub.add(subscribeNext);
|
|
1508
1617
|
} else {
|
|
1509
1618
|
subscriber.complete();
|
|
@@ -1512,174 +1621,188 @@ export function onErrorResumeNext(fa, ...sources) {
|
|
|
1512
1621
|
};
|
|
1513
1622
|
|
|
1514
1623
|
subscribeNext();
|
|
1515
|
-
});
|
|
1624
|
+
})(fa);
|
|
1516
1625
|
}
|
|
1517
1626
|
/**
|
|
1518
|
-
* @tsplus
|
|
1627
|
+
* @tsplus pipeable fncts.observable.Observable onEmpty
|
|
1519
1628
|
*/
|
|
1520
1629
|
|
|
1521
|
-
function onEmpty_1(
|
|
1522
|
-
return
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1630
|
+
function onEmpty_1(f) {
|
|
1631
|
+
return fa => {
|
|
1632
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1633
|
+
let hasValue = false;
|
|
1634
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1635
|
+
next: value => {
|
|
1636
|
+
hasValue = true;
|
|
1637
|
+
subscriber.next(value);
|
|
1638
|
+
},
|
|
1639
|
+
complete: () => {
|
|
1640
|
+
if (!hasValue) {
|
|
1641
|
+
subscriber.next(f());
|
|
1642
|
+
}
|
|
1533
1643
|
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1644
|
+
subscriber.complete();
|
|
1645
|
+
}
|
|
1646
|
+
}));
|
|
1647
|
+
})(fa);
|
|
1648
|
+
};
|
|
1538
1649
|
}
|
|
1539
1650
|
/**
|
|
1540
|
-
* @tsplus
|
|
1651
|
+
* @tsplus pipeable fncts.observable.Observable repeat
|
|
1541
1652
|
*/
|
|
1542
1653
|
|
|
1543
1654
|
|
|
1544
|
-
export function
|
|
1545
|
-
return
|
|
1546
|
-
|
|
1547
|
-
|
|
1655
|
+
export function repeat(count = Infinity) {
|
|
1656
|
+
return fa => {
|
|
1657
|
+
return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1658
|
+
let repeats = 0;
|
|
1659
|
+
let innerSub;
|
|
1548
1660
|
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1661
|
+
const loop = () => {
|
|
1662
|
+
let syncUnsub = false;
|
|
1663
|
+
innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1664
|
+
complete: () => {
|
|
1665
|
+
if (++repeats < count) {
|
|
1666
|
+
if (innerSub) {
|
|
1667
|
+
innerSub.unsubscribe();
|
|
1668
|
+
innerSub = null;
|
|
1669
|
+
loop();
|
|
1670
|
+
} else {
|
|
1671
|
+
syncUnsub = true;
|
|
1672
|
+
}
|
|
1558
1673
|
} else {
|
|
1559
|
-
|
|
1674
|
+
subscriber.complete;
|
|
1560
1675
|
}
|
|
1561
|
-
} else {
|
|
1562
|
-
subscriber.complete;
|
|
1563
1676
|
}
|
|
1564
|
-
}
|
|
1565
|
-
}));
|
|
1677
|
+
}));
|
|
1566
1678
|
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1679
|
+
if (syncUnsub) {
|
|
1680
|
+
innerSub.unsubscribe();
|
|
1681
|
+
innerSub = null;
|
|
1682
|
+
loop();
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1573
1685
|
|
|
1574
|
-
|
|
1575
|
-
|
|
1686
|
+
loop();
|
|
1687
|
+
})(fa);
|
|
1688
|
+
};
|
|
1576
1689
|
}
|
|
1577
|
-
export function
|
|
1578
|
-
|
|
1690
|
+
export function retry(configOrCount = Infinity) {
|
|
1691
|
+
return fa => {
|
|
1692
|
+
let config;
|
|
1579
1693
|
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1694
|
+
if (configOrCount && typeof configOrCount === "object") {
|
|
1695
|
+
config = configOrCount;
|
|
1696
|
+
} else {
|
|
1697
|
+
config = {
|
|
1698
|
+
count: configOrCount
|
|
1699
|
+
};
|
|
1700
|
+
}
|
|
1587
1701
|
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1702
|
+
const {
|
|
1703
|
+
count,
|
|
1704
|
+
resetOnSuccess = false
|
|
1705
|
+
} = config;
|
|
1706
|
+
return count <= 0 ? fa : tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1707
|
+
let retries = 0;
|
|
1708
|
+
let innerSub;
|
|
1709
|
+
|
|
1710
|
+
const loop = () => {
|
|
1711
|
+
let syncUnsub = false;
|
|
1712
|
+
innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1713
|
+
next: value => {
|
|
1714
|
+
if (resetOnSuccess) {
|
|
1715
|
+
retries = 0;
|
|
1716
|
+
}
|
|
1603
1717
|
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1718
|
+
subscriber.next(value);
|
|
1719
|
+
},
|
|
1720
|
+
error: err => {
|
|
1721
|
+
if (retries++ < count) {
|
|
1722
|
+
if (innerSub) {
|
|
1723
|
+
innerSub.unsubscribe();
|
|
1724
|
+
innerSub = null;
|
|
1725
|
+
loop();
|
|
1726
|
+
} else {
|
|
1727
|
+
syncUnsub = true;
|
|
1728
|
+
}
|
|
1612
1729
|
} else {
|
|
1613
|
-
|
|
1730
|
+
subscriber.error(err);
|
|
1614
1731
|
}
|
|
1615
|
-
} else {
|
|
1616
|
-
subscriber.error(err);
|
|
1617
1732
|
}
|
|
1618
|
-
}
|
|
1619
|
-
}));
|
|
1733
|
+
}));
|
|
1620
1734
|
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1735
|
+
if (syncUnsub) {
|
|
1736
|
+
innerSub.unsubscribe();
|
|
1737
|
+
innerSub = null;
|
|
1738
|
+
loop();
|
|
1739
|
+
}
|
|
1740
|
+
};
|
|
1627
1741
|
|
|
1628
|
-
|
|
1629
|
-
|
|
1742
|
+
loop();
|
|
1743
|
+
})(fa);
|
|
1744
|
+
};
|
|
1630
1745
|
}
|
|
1631
1746
|
/**
|
|
1632
|
-
* @tsplus
|
|
1747
|
+
* @tsplus pipeable fncts.observable.Observable sample
|
|
1633
1748
|
*/
|
|
1634
1749
|
|
|
1635
|
-
function sample_1(
|
|
1636
|
-
return
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1750
|
+
function sample_1(notifier) {
|
|
1751
|
+
return fa => {
|
|
1752
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1753
|
+
let hasValue = false;
|
|
1754
|
+
let lastValue = null;
|
|
1755
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1756
|
+
next: value => {
|
|
1757
|
+
hasValue = true;
|
|
1758
|
+
lastValue = value;
|
|
1759
|
+
}
|
|
1760
|
+
}));
|
|
1645
1761
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1762
|
+
const emit = () => {
|
|
1763
|
+
if (hasValue) {
|
|
1764
|
+
hasValue = false;
|
|
1765
|
+
const value = lastValue;
|
|
1766
|
+
lastValue = null;
|
|
1767
|
+
subscriber.next(value);
|
|
1768
|
+
}
|
|
1769
|
+
};
|
|
1654
1770
|
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1771
|
+
notifier.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1772
|
+
next: emit,
|
|
1773
|
+
complete: tsplus_module_2.noop
|
|
1774
|
+
}));
|
|
1775
|
+
})(fa);
|
|
1776
|
+
};
|
|
1660
1777
|
}
|
|
1661
1778
|
/**
|
|
1662
|
-
* @tsplus
|
|
1779
|
+
* @tsplus pipeable fncts.observable.Observable sampleTime
|
|
1663
1780
|
*/
|
|
1664
1781
|
|
|
1665
1782
|
|
|
1666
|
-
export function
|
|
1667
|
-
return
|
|
1783
|
+
export function sampleTime(period, scheduler = tsplus_module_5.asyncScheduler) {
|
|
1784
|
+
return fa => {
|
|
1785
|
+
return sample_1(interval_1(period, scheduler))(fa);
|
|
1786
|
+
};
|
|
1668
1787
|
}
|
|
1669
1788
|
/**
|
|
1670
|
-
* @tsplus
|
|
1789
|
+
* @tsplus pipeable fncts.observable.Observable scanLeftWithIndex
|
|
1671
1790
|
*/
|
|
1672
1791
|
|
|
1673
|
-
function scanLeftWithIndex_1(
|
|
1674
|
-
return
|
|
1792
|
+
function scanLeftWithIndex_1(initial, f) {
|
|
1793
|
+
return fa => {
|
|
1794
|
+
return tsplus_module_8.operate_(scanInternal(f, initial, true, true))(fa);
|
|
1795
|
+
};
|
|
1675
1796
|
}
|
|
1676
1797
|
/**
|
|
1677
|
-
* @tsplus
|
|
1798
|
+
* @tsplus pipeable fncts.observable.Observable scanLeft
|
|
1678
1799
|
*/
|
|
1679
1800
|
|
|
1680
1801
|
|
|
1681
|
-
export function scanLeft(
|
|
1682
|
-
return
|
|
1802
|
+
export function scanLeft(initial, f) {
|
|
1803
|
+
return fa => {
|
|
1804
|
+
return scanLeftWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
|
|
1805
|
+
};
|
|
1683
1806
|
}
|
|
1684
1807
|
/**
|
|
1685
1808
|
* @tsplus static fncts.observable.ObservableOps service
|
|
@@ -1706,327 +1829,363 @@ tag) {
|
|
|
1706
1829
|
function serviceWithObservable_1(f,
|
|
1707
1830
|
/** @tsplus auto */
|
|
1708
1831
|
tag) {
|
|
1709
|
-
return environmentWithObservable_1(environment => f(tsplus_module_16.unsafeGet(
|
|
1832
|
+
return environmentWithObservable_1(environment => f(tsplus_module_16.unsafeGet(tag)(environment)));
|
|
1710
1833
|
}
|
|
1711
1834
|
/**
|
|
1712
|
-
* @tsplus
|
|
1835
|
+
* @tsplus pipeable fncts.observable.Observable skip
|
|
1713
1836
|
*/
|
|
1714
1837
|
|
|
1715
1838
|
|
|
1716
|
-
export function
|
|
1717
|
-
return
|
|
1839
|
+
export function skip(count) {
|
|
1840
|
+
return fa => {
|
|
1841
|
+
return filterWithIndex_1((index, _) => count <= index)(fa);
|
|
1842
|
+
};
|
|
1718
1843
|
}
|
|
1719
1844
|
/**
|
|
1720
|
-
* @tsplus
|
|
1845
|
+
* @tsplus pipeable fncts.observable.Observable skipLast
|
|
1721
1846
|
*/
|
|
1722
1847
|
|
|
1723
|
-
export function
|
|
1724
|
-
return
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1848
|
+
export function skipLast(skipCount) {
|
|
1849
|
+
return fa => {
|
|
1850
|
+
return skipCount <= 0 ? fa : tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1851
|
+
let ring = new Array(skipCount);
|
|
1852
|
+
let seen = 0;
|
|
1853
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1854
|
+
next: value => {
|
|
1855
|
+
const valueIndex = seen++;
|
|
1730
1856
|
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1857
|
+
if (valueIndex < skipCount) {
|
|
1858
|
+
ring[valueIndex] = value;
|
|
1859
|
+
} else {
|
|
1860
|
+
const index = valueIndex % skipCount;
|
|
1861
|
+
const oldValue = ring[index];
|
|
1862
|
+
ring[index] = value;
|
|
1863
|
+
subscriber.next(oldValue);
|
|
1864
|
+
}
|
|
1738
1865
|
}
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
};
|
|
1744
|
-
}
|
|
1866
|
+
}));
|
|
1867
|
+
return () => {
|
|
1868
|
+
ring = null;
|
|
1869
|
+
};
|
|
1870
|
+
})(fa);
|
|
1871
|
+
};
|
|
1745
1872
|
}
|
|
1746
1873
|
/**
|
|
1747
|
-
* @tsplus
|
|
1874
|
+
* @tsplus pipeable fncts.observable.Observable skipUntil
|
|
1748
1875
|
*/
|
|
1749
1876
|
|
|
1750
|
-
export function
|
|
1751
|
-
return
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1877
|
+
export function skipUntil(notifier) {
|
|
1878
|
+
return fa => {
|
|
1879
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1880
|
+
let taking = false;
|
|
1881
|
+
const skipSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1882
|
+
next: () => {
|
|
1883
|
+
skipSubscriber?.unsubscribe();
|
|
1884
|
+
taking = true;
|
|
1885
|
+
},
|
|
1886
|
+
complete: tsplus_module_2.noop
|
|
1887
|
+
});
|
|
1888
|
+
from_1(notifier).provideEnvironment(environment).subscribe(skipSubscriber);
|
|
1889
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1890
|
+
next: value => taking && subscriber.next(value)
|
|
1891
|
+
}));
|
|
1892
|
+
})(fa);
|
|
1893
|
+
};
|
|
1765
1894
|
}
|
|
1766
1895
|
/**
|
|
1767
|
-
* @tsplus
|
|
1896
|
+
* @tsplus pipeable fncts.observable.Observable skipWhile
|
|
1768
1897
|
*/
|
|
1769
1898
|
|
|
1770
|
-
export function
|
|
1771
|
-
return
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1899
|
+
export function skipWhile(predicate) {
|
|
1900
|
+
return fa => {
|
|
1901
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1902
|
+
let taking = false;
|
|
1903
|
+
let index = 0;
|
|
1904
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1905
|
+
next: value => (taking || (taking = !predicate(index++, value))) && subscriber.next(value)
|
|
1906
|
+
}));
|
|
1907
|
+
})(fa);
|
|
1908
|
+
};
|
|
1778
1909
|
}
|
|
1779
1910
|
/**
|
|
1780
|
-
* @tsplus
|
|
1911
|
+
* @tsplus pipeable fncts.observable.Observable startWith
|
|
1781
1912
|
*/
|
|
1782
1913
|
|
|
1783
|
-
export function
|
|
1784
|
-
return
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1914
|
+
export function startWith(...values) {
|
|
1915
|
+
return fa => {
|
|
1916
|
+
return tsplus_module_8.operate_((source, subscriber) => {
|
|
1917
|
+
// @ts-expect-error
|
|
1918
|
+
concat_1(values)(source).subscribe(subscriber);
|
|
1919
|
+
})(fa);
|
|
1920
|
+
};
|
|
1788
1921
|
}
|
|
1789
1922
|
/**
|
|
1790
|
-
* @tsplus
|
|
1923
|
+
* @tsplus pipeable fncts.observable.Observable subscribeOn
|
|
1791
1924
|
*/
|
|
1792
1925
|
|
|
1793
|
-
export function
|
|
1794
|
-
return
|
|
1795
|
-
|
|
1796
|
-
|
|
1926
|
+
export function subscribeOn(scheduler, delay = 0) {
|
|
1927
|
+
return fa => {
|
|
1928
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1929
|
+
subscriber.add(scheduler.schedule(() => source.provideEnvironment(environment).subscribe(subscriber), delay));
|
|
1930
|
+
})(fa);
|
|
1931
|
+
};
|
|
1797
1932
|
}
|
|
1798
1933
|
/**
|
|
1799
1934
|
* @tsplus getter fncts.observable.Observable switchAll
|
|
1800
1935
|
*/
|
|
1801
1936
|
|
|
1802
1937
|
export function switchAll(ffa) {
|
|
1803
|
-
return switchMap_1(
|
|
1938
|
+
return switchMap_1(tsplus_module_13.identity)(ffa);
|
|
1804
1939
|
}
|
|
1805
1940
|
/**
|
|
1806
|
-
* @tsplus
|
|
1941
|
+
* @tsplus pipeable fncts.observable.Observable switchMapWithIndex
|
|
1807
1942
|
*/
|
|
1808
1943
|
|
|
1809
|
-
function switchMapWithIndex_1(
|
|
1810
|
-
return
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1944
|
+
function switchMapWithIndex_1(f) {
|
|
1945
|
+
return fa => {
|
|
1946
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1947
|
+
let innerSubscriber = null;
|
|
1948
|
+
let index = 0;
|
|
1949
|
+
let isComplete = false;
|
|
1814
1950
|
|
|
1815
|
-
|
|
1951
|
+
const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();
|
|
1816
1952
|
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1953
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1954
|
+
next: value => {
|
|
1955
|
+
innerSubscriber?.unsubscribe();
|
|
1956
|
+
const outerIndex = index++;
|
|
1957
|
+
from_1(f(outerIndex, value)).provideEnvironment(environment).subscribe(innerSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1958
|
+
next: innerValue => subscriber.next(innerValue),
|
|
1959
|
+
complete: () => {
|
|
1960
|
+
innerSubscriber = null;
|
|
1961
|
+
checkComplete();
|
|
1962
|
+
}
|
|
1963
|
+
}));
|
|
1964
|
+
}
|
|
1965
|
+
}, () => {
|
|
1966
|
+
isComplete = true;
|
|
1967
|
+
checkComplete();
|
|
1968
|
+
}));
|
|
1969
|
+
})(fa);
|
|
1970
|
+
};
|
|
1834
1971
|
}
|
|
1835
1972
|
/**
|
|
1836
|
-
* @tsplus
|
|
1973
|
+
* @tsplus pipeable fncts.observable.Observable switchMap
|
|
1837
1974
|
*/
|
|
1838
1975
|
|
|
1839
1976
|
|
|
1840
|
-
function switchMap_1(
|
|
1841
|
-
return
|
|
1977
|
+
function switchMap_1(f) {
|
|
1978
|
+
return fa => {
|
|
1979
|
+
return switchMapWithIndex_1((_, a) => f(a))(fa);
|
|
1980
|
+
};
|
|
1842
1981
|
}
|
|
1843
1982
|
/**
|
|
1844
|
-
* @tsplus
|
|
1983
|
+
* @tsplus pipeable fncts.observable.Observable switchScanWithIndex
|
|
1845
1984
|
*/
|
|
1846
1985
|
|
|
1847
1986
|
|
|
1848
|
-
function switchScanWithIndex_1(
|
|
1849
|
-
return
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1987
|
+
function switchScanWithIndex_1(initial, f) {
|
|
1988
|
+
return fa => {
|
|
1989
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1990
|
+
let state = initial;
|
|
1991
|
+
switchMapWithIndex_1((index, value) => map_1(b => (state = b, b))(from_1(f(index, state, value))))(source).provideEnvironment(environment).subscribe(subscriber);
|
|
1992
|
+
return () => {
|
|
1993
|
+
state = null;
|
|
1994
|
+
};
|
|
1995
|
+
})(fa);
|
|
1996
|
+
};
|
|
1856
1997
|
}
|
|
1857
1998
|
/**
|
|
1858
|
-
* @tsplus
|
|
1999
|
+
* @tsplus pipeable fncts.observable.Observable switchScan
|
|
1859
2000
|
*/
|
|
1860
2001
|
|
|
1861
2002
|
|
|
1862
|
-
export function
|
|
1863
|
-
return
|
|
2003
|
+
export function switchScan(initial, f) {
|
|
2004
|
+
return fa => {
|
|
2005
|
+
return switchScanWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
|
|
2006
|
+
};
|
|
1864
2007
|
}
|
|
1865
2008
|
/**
|
|
1866
|
-
* @tsplus
|
|
2009
|
+
* @tsplus pipeable fncts.observable.Observable take
|
|
1867
2010
|
*/
|
|
1868
2011
|
|
|
1869
|
-
function take_1(
|
|
1870
|
-
return
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
2012
|
+
function take_1(count) {
|
|
2013
|
+
return fa => {
|
|
2014
|
+
return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, sub, environment) => {
|
|
2015
|
+
let seen = 0;
|
|
2016
|
+
source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(sub, {
|
|
2017
|
+
next: value => {
|
|
2018
|
+
if (++seen <= count) {
|
|
2019
|
+
sub.next(value);
|
|
1876
2020
|
|
|
1877
|
-
|
|
1878
|
-
|
|
2021
|
+
if (count <= seen) {
|
|
2022
|
+
sub.complete();
|
|
2023
|
+
}
|
|
1879
2024
|
}
|
|
1880
2025
|
}
|
|
1881
|
-
}
|
|
1882
|
-
}));
|
|
1883
|
-
}
|
|
2026
|
+
}));
|
|
2027
|
+
})(fa);
|
|
2028
|
+
};
|
|
1884
2029
|
}
|
|
1885
2030
|
/**
|
|
1886
|
-
* @tsplus
|
|
2031
|
+
* @tsplus pipeable fncts.observable.Observable takeLast
|
|
1887
2032
|
*/
|
|
1888
2033
|
|
|
1889
2034
|
|
|
1890
|
-
export function
|
|
1891
|
-
return
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
2035
|
+
export function takeLast(count) {
|
|
2036
|
+
return fa => {
|
|
2037
|
+
return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
2038
|
+
let buffer = [];
|
|
2039
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2040
|
+
next: value => {
|
|
2041
|
+
buffer.push(value);
|
|
2042
|
+
count < buffer.length && buffer.shift();
|
|
2043
|
+
},
|
|
2044
|
+
complete: () => {
|
|
2045
|
+
for (const value of buffer) {
|
|
2046
|
+
subscriber.next(value);
|
|
2047
|
+
}
|
|
1902
2048
|
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
2049
|
+
subscriber.complete();
|
|
2050
|
+
}
|
|
2051
|
+
}, () => {
|
|
2052
|
+
buffer = null;
|
|
2053
|
+
}));
|
|
2054
|
+
})(fa);
|
|
2055
|
+
};
|
|
1909
2056
|
}
|
|
1910
2057
|
/**
|
|
1911
|
-
* @tsplus
|
|
2058
|
+
* @tsplus pipeable fncts.observable.Observable takeUntil
|
|
1912
2059
|
*/
|
|
1913
2060
|
|
|
1914
|
-
export function
|
|
1915
|
-
return
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
2061
|
+
export function takeUntil(notifier) {
|
|
2062
|
+
return fa => {
|
|
2063
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
2064
|
+
from_1(notifier).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2065
|
+
next: () => subscriber.complete(),
|
|
2066
|
+
complete: tsplus_module_2.noop
|
|
2067
|
+
}));
|
|
2068
|
+
!subscriber.closed && source.provideEnvironment(environment).subscribe(subscriber);
|
|
2069
|
+
})(fa);
|
|
2070
|
+
};
|
|
1922
2071
|
}
|
|
1923
2072
|
|
|
1924
|
-
function takeWhileWithIndex_1(
|
|
1925
|
-
return
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
2073
|
+
function takeWhileWithIndex_1(predicate, inclusive) {
|
|
2074
|
+
return fa => {
|
|
2075
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
2076
|
+
let index = 0;
|
|
2077
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2078
|
+
next: value => {
|
|
2079
|
+
const result = predicate(index++, value);
|
|
2080
|
+
(result || inclusive) && subscriber.next(value);
|
|
2081
|
+
!result && subscriber.complete();
|
|
2082
|
+
}
|
|
2083
|
+
}));
|
|
2084
|
+
})(fa);
|
|
2085
|
+
};
|
|
1935
2086
|
}
|
|
1936
2087
|
|
|
1937
|
-
export function
|
|
1938
|
-
return
|
|
2088
|
+
export function takeWhile(predicate, inclusive) {
|
|
2089
|
+
return fa => {
|
|
2090
|
+
return takeWhileWithIndex_1((_, a) => predicate(a), inclusive)(fa);
|
|
2091
|
+
};
|
|
1939
2092
|
}
|
|
1940
2093
|
/**
|
|
1941
|
-
* @tsplus
|
|
2094
|
+
* @tsplus pipeable fncts.observable.Observable tap
|
|
1942
2095
|
*/
|
|
1943
2096
|
|
|
1944
|
-
export function
|
|
1945
|
-
return
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
2097
|
+
export function tap(observer) {
|
|
2098
|
+
return fa => {
|
|
2099
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
2100
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2101
|
+
next: value => {
|
|
2102
|
+
observer.next?.(value);
|
|
2103
|
+
subscriber.next(value);
|
|
2104
|
+
},
|
|
2105
|
+
error: err => {
|
|
2106
|
+
observer.error?.(err);
|
|
2107
|
+
subscriber.error(err);
|
|
2108
|
+
},
|
|
2109
|
+
complete: () => {
|
|
2110
|
+
observer.complete?.();
|
|
2111
|
+
subscriber.complete();
|
|
2112
|
+
}
|
|
2113
|
+
}));
|
|
2114
|
+
})(fa);
|
|
2115
|
+
};
|
|
1961
2116
|
}
|
|
1962
2117
|
export const defaultThrottleConfig = {
|
|
1963
2118
|
leading: true,
|
|
1964
2119
|
trailing: false
|
|
1965
2120
|
};
|
|
1966
2121
|
/**
|
|
1967
|
-
* @tsplus
|
|
2122
|
+
* @tsplus pipeable fncts.observable.Observable throttle
|
|
1968
2123
|
*/
|
|
1969
2124
|
|
|
1970
|
-
function throttle_1(
|
|
2125
|
+
function throttle_1(durationSelector, {
|
|
1971
2126
|
leading,
|
|
1972
2127
|
trailing
|
|
1973
2128
|
} = defaultThrottleConfig) {
|
|
1974
|
-
return
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
2129
|
+
return fa => {
|
|
2130
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
2131
|
+
let sendValue = tsplus_module_17.nothing();
|
|
2132
|
+
let throttled = null;
|
|
2133
|
+
let isComplete = false;
|
|
2134
|
+
|
|
2135
|
+
const endThrottling = () => {
|
|
2136
|
+
throttled?.unsubscribe();
|
|
2137
|
+
throttled = null;
|
|
2138
|
+
|
|
2139
|
+
if (trailing) {
|
|
2140
|
+
send();
|
|
2141
|
+
isComplete && subscriber.complete();
|
|
2142
|
+
}
|
|
2143
|
+
};
|
|
1982
2144
|
|
|
1983
|
-
|
|
1984
|
-
|
|
2145
|
+
const cleanupThrottling = () => {
|
|
2146
|
+
throttled = null;
|
|
1985
2147
|
isComplete && subscriber.complete();
|
|
1986
|
-
}
|
|
1987
|
-
};
|
|
1988
|
-
|
|
1989
|
-
const cleanupThrottling = () => {
|
|
1990
|
-
throttled = null;
|
|
1991
|
-
isComplete && subscriber.complete();
|
|
1992
|
-
};
|
|
2148
|
+
};
|
|
1993
2149
|
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2150
|
+
const startThrottling = value => throttled = from_1(durationSelector(value)).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2151
|
+
next: endThrottling,
|
|
2152
|
+
complete: cleanupThrottling
|
|
2153
|
+
}));
|
|
1998
2154
|
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2155
|
+
const send = () => {
|
|
2156
|
+
if (tsplus_module_18.isJust(sendValue)) {
|
|
2157
|
+
const {
|
|
2158
|
+
value
|
|
2159
|
+
} = sendValue;
|
|
2160
|
+
sendValue = tsplus_module_17.nothing();
|
|
2161
|
+
subscriber.next(value);
|
|
2162
|
+
!isComplete && startThrottling(value);
|
|
2163
|
+
}
|
|
2164
|
+
};
|
|
2009
2165
|
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2166
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2167
|
+
next: value => {
|
|
2168
|
+
sendValue = tsplus_module_17.just(value);
|
|
2169
|
+
!(throttled && !throttled.closed) && (leading ? send() : startThrottling(value));
|
|
2170
|
+
},
|
|
2171
|
+
complete: () => {
|
|
2172
|
+
isComplete = true;
|
|
2173
|
+
!(trailing && tsplus_module_18.isJust(sendValue) && throttled && !throttled.closed) && subscriber.complete();
|
|
2174
|
+
}
|
|
2175
|
+
}));
|
|
2176
|
+
})(fa);
|
|
2177
|
+
};
|
|
2021
2178
|
}
|
|
2022
2179
|
/**
|
|
2023
|
-
* @tsplus
|
|
2180
|
+
* @tsplus pipeable fncts.observable.Observable throttleTime
|
|
2024
2181
|
*/
|
|
2025
2182
|
|
|
2026
2183
|
|
|
2027
|
-
export function
|
|
2028
|
-
|
|
2029
|
-
|
|
2184
|
+
export function throttleTime(duration, scheduler = tsplus_module_5.asyncScheduler, config = defaultThrottleConfig) {
|
|
2185
|
+
return fa => {
|
|
2186
|
+
const duration$ = timer_1(duration, scheduler);
|
|
2187
|
+
return throttle_1(() => duration$, config)(fa);
|
|
2188
|
+
};
|
|
2030
2189
|
}
|
|
2031
2190
|
export class TimeoutError extends Error {
|
|
2032
2191
|
constructor(info) {
|
|
@@ -2036,49 +2195,51 @@ export class TimeoutError extends Error {
|
|
|
2036
2195
|
}
|
|
2037
2196
|
|
|
2038
2197
|
}
|
|
2039
|
-
export function
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
timerSubscription?.
|
|
2076
|
-
|
|
2198
|
+
export function timeout(config) {
|
|
2199
|
+
return fa => {
|
|
2200
|
+
const {
|
|
2201
|
+
first,
|
|
2202
|
+
each,
|
|
2203
|
+
with: _with = timeoutError,
|
|
2204
|
+
scheduler = tsplus_module_5.asyncScheduler,
|
|
2205
|
+
meta = null
|
|
2206
|
+
} = config;
|
|
2207
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
2208
|
+
// eslint-disable-next-line prefer-const
|
|
2209
|
+
let originalSourceSubscription;
|
|
2210
|
+
let timerSubscription;
|
|
2211
|
+
let lastValue = tsplus_module_17.nothing();
|
|
2212
|
+
let seen = 0;
|
|
2213
|
+
|
|
2214
|
+
const startTimer = delay => {
|
|
2215
|
+
timerSubscription = caughtSchedule(subscriber, scheduler, () => {
|
|
2216
|
+
originalSourceSubscription.unsubscribe();
|
|
2217
|
+
from_1(_with({
|
|
2218
|
+
meta,
|
|
2219
|
+
lastValue,
|
|
2220
|
+
seen
|
|
2221
|
+
})).provideEnvironment(environment).subscribe(subscriber);
|
|
2222
|
+
}, delay);
|
|
2223
|
+
};
|
|
2224
|
+
|
|
2225
|
+
originalSourceSubscription = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2226
|
+
next: value => {
|
|
2227
|
+
timerSubscription?.unsubscribe();
|
|
2228
|
+
seen++;
|
|
2229
|
+
lastValue = tsplus_module_17.just(value);
|
|
2230
|
+
subscriber.next(value);
|
|
2231
|
+
each > 0 && startTimer(each);
|
|
2232
|
+
}
|
|
2233
|
+
}, () => {
|
|
2234
|
+
if (!timerSubscription?.closed) {
|
|
2235
|
+
timerSubscription?.unsubscribe();
|
|
2236
|
+
}
|
|
2077
2237
|
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2238
|
+
lastValue = tsplus_module_17.nothing();
|
|
2239
|
+
}));
|
|
2240
|
+
startTimer(first != null ? typeof first === "number" ? first : +first - scheduler.now() : each);
|
|
2241
|
+
})(fa);
|
|
2242
|
+
};
|
|
2082
2243
|
}
|
|
2083
2244
|
|
|
2084
2245
|
function timeoutError(info) {
|
|
@@ -2094,60 +2255,66 @@ function toArrayAccumulator(arr, value) {
|
|
|
2094
2255
|
|
|
2095
2256
|
|
|
2096
2257
|
function toArray_1(fa) {
|
|
2097
|
-
return tsplus_module_8.operate_(
|
|
2098
|
-
foldLeft_1(
|
|
2099
|
-
});
|
|
2258
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
2259
|
+
foldLeft_1([], toArrayAccumulator)(source).provideEnvironment(environment).subscribe(subscriber);
|
|
2260
|
+
})(fa);
|
|
2100
2261
|
}
|
|
2101
2262
|
/**
|
|
2102
|
-
* @tsplus
|
|
2263
|
+
* @tsplus pipeable fncts.observable.Observable unique
|
|
2103
2264
|
*/
|
|
2104
2265
|
|
|
2105
2266
|
|
|
2106
|
-
export function
|
|
2107
|
-
return
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2267
|
+
export function unique(toKey, flushes) {
|
|
2268
|
+
return fa => {
|
|
2269
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
2270
|
+
let distinctKeys = tsplus_module_21.makeDefault();
|
|
2271
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2272
|
+
next: value => {
|
|
2273
|
+
const key = toKey ? toKey(value) : value;
|
|
2112
2274
|
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2275
|
+
if (!tsplus_module_21.has(key)(distinctKeys)) {
|
|
2276
|
+
tsplus_module_21.add(key)(distinctKeys);
|
|
2277
|
+
subscriber.next(value);
|
|
2278
|
+
}
|
|
2116
2279
|
}
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
}));
|
|
2123
|
-
}
|
|
2280
|
+
}));
|
|
2281
|
+
flushes?.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2282
|
+
next: () => distinctKeys = tsplus_module_21.makeDefault(),
|
|
2283
|
+
complete: tsplus_module_2.noop
|
|
2284
|
+
}));
|
|
2285
|
+
})(fa);
|
|
2286
|
+
};
|
|
2124
2287
|
}
|
|
2125
2288
|
|
|
2126
|
-
function uniqueUntilChanged_1(
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2289
|
+
function uniqueUntilChanged_1(E, keySelector = tsplus_module_13.identity) {
|
|
2290
|
+
return fa => {
|
|
2291
|
+
const compare = "equals" in E ? E.equals : E;
|
|
2292
|
+
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
2293
|
+
let previousKey;
|
|
2294
|
+
let first = true;
|
|
2295
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2296
|
+
next: value => {
|
|
2297
|
+
const currentKey = keySelector(value);
|
|
2134
2298
|
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2299
|
+
if (first || !compare(previousKey, currentKey)) {
|
|
2300
|
+
first = false;
|
|
2301
|
+
previousKey = currentKey;
|
|
2302
|
+
subscriber.next(value);
|
|
2303
|
+
}
|
|
2139
2304
|
}
|
|
2140
|
-
}
|
|
2141
|
-
}));
|
|
2142
|
-
}
|
|
2305
|
+
}));
|
|
2306
|
+
})(fa);
|
|
2307
|
+
};
|
|
2143
2308
|
}
|
|
2144
2309
|
|
|
2145
|
-
export function
|
|
2146
|
-
|
|
2147
|
-
|
|
2310
|
+
export function uniqueUntilKeyChanged(key, equals) {
|
|
2311
|
+
return fa => {
|
|
2312
|
+
const compare = "equals" in equals ? equals.equals : equals;
|
|
2313
|
+
return uniqueUntilChanged_1((x, y) => compare(x[key], y[key]))(fa);
|
|
2314
|
+
};
|
|
2148
2315
|
}
|
|
2149
2316
|
|
|
2150
|
-
function combineLatestInternal(subscriber, observables, scheduler, valueTransform = tsplus_module_13.identity) {
|
|
2317
|
+
function combineLatestInternal(subscriber, environment, observables, scheduler, valueTransform = tsplus_module_13.identity) {
|
|
2151
2318
|
return maybeSchedule(subscriber, scheduler, () => {
|
|
2152
2319
|
const {
|
|
2153
2320
|
length
|
|
@@ -2158,9 +2325,9 @@ function combineLatestInternal(subscriber, observables, scheduler, valueTransfor
|
|
|
2158
2325
|
|
|
2159
2326
|
for (let i = 0; i < length; i++) {
|
|
2160
2327
|
maybeSchedule(subscriber, scheduler, () => {
|
|
2161
|
-
const source = scheduler ? scheduled_1(observables[i]
|
|
2328
|
+
const source = scheduler ? scheduled_1(scheduler)(observables[i]) : from_1(observables[i]);
|
|
2162
2329
|
let hasFirstValue = false;
|
|
2163
|
-
source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2330
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2164
2331
|
next: value => {
|
|
2165
2332
|
values[i] = value;
|
|
2166
2333
|
|
|
@@ -2186,9 +2353,9 @@ function combineLatestInternal(subscriber, observables, scheduler, valueTransfor
|
|
|
2186
2353
|
|
|
2187
2354
|
function findInternal(predicate, emit) {
|
|
2188
2355
|
const findIndex = emit === "index";
|
|
2189
|
-
return (source, subscriber) => {
|
|
2356
|
+
return (source, subscriber, environment) => {
|
|
2190
2357
|
let index = 0;
|
|
2191
|
-
source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2358
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2192
2359
|
next: value => {
|
|
2193
2360
|
const i = index++;
|
|
2194
2361
|
|
|
@@ -2206,7 +2373,7 @@ function findInternal(predicate, emit) {
|
|
|
2206
2373
|
}
|
|
2207
2374
|
|
|
2208
2375
|
export function joinAllInternal(fa, joiner) {
|
|
2209
|
-
return mergeMap_1(toArray_1(fa)
|
|
2376
|
+
return mergeMap_1(joiner)(toArray_1(fa));
|
|
2210
2377
|
}
|
|
2211
2378
|
|
|
2212
2379
|
function maybeSchedule(subscription, scheduler, execute) {
|
|
@@ -2217,7 +2384,7 @@ function maybeSchedule(subscription, scheduler, execute) {
|
|
|
2217
2384
|
}
|
|
2218
2385
|
}
|
|
2219
2386
|
|
|
2220
|
-
function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
|
|
2387
|
+
function mergeInternal(source, subscriber, environment, f, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
|
|
2221
2388
|
const buffer = [];
|
|
2222
2389
|
let active = 0;
|
|
2223
2390
|
let index = 0;
|
|
@@ -2235,7 +2402,7 @@ function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand,
|
|
|
2235
2402
|
expand && subscriber.next(a);
|
|
2236
2403
|
active++;
|
|
2237
2404
|
let innerComplete = false;
|
|
2238
|
-
from_1(f(index++, a)).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
2405
|
+
from_1(f(index++, a)).provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
2239
2406
|
next: b => {
|
|
2240
2407
|
onBeforeNext?.(b);
|
|
2241
2408
|
|
|
@@ -2266,7 +2433,7 @@ function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand,
|
|
|
2266
2433
|
}));
|
|
2267
2434
|
};
|
|
2268
2435
|
|
|
2269
|
-
source.subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
2436
|
+
source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
2270
2437
|
next: outerNext,
|
|
2271
2438
|
complete: () => {
|
|
2272
2439
|
isComplete = true;
|
|
@@ -2279,11 +2446,11 @@ function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand,
|
|
|
2279
2446
|
}
|
|
2280
2447
|
|
|
2281
2448
|
export function scanInternal(f, initial, hasInitial, emitOnNext, emitBeforeComplete) {
|
|
2282
|
-
return (source, subscriber) => {
|
|
2449
|
+
return (source, subscriber, environment) => {
|
|
2283
2450
|
let hasState = hasInitial;
|
|
2284
2451
|
let state = initial;
|
|
2285
2452
|
let index = 0;
|
|
2286
|
-
source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2453
|
+
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2287
2454
|
next: value => {
|
|
2288
2455
|
const i = index++;
|
|
2289
2456
|
state = hasState ? f(i, state, value) : (hasState = true, value);
|