@fncts/observable 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Observable/api.d.ts +1 -1
- package/ObservableRef/api.d.ts +63 -0
- package/ObservableRef/atomic.d.ts +32 -0
- package/ObservableRef/definition.d.ts +52 -0
- package/_cjs/Action.cjs +0 -7
- package/_cjs/Action.cjs.map +1 -1
- package/_cjs/AnimationFrameAction.cjs +0 -12
- package/_cjs/AnimationFrameAction.cjs.map +1 -1
- package/_cjs/AnimationFrameScheduler.cjs +0 -11
- package/_cjs/AnimationFrameScheduler.cjs.map +1 -1
- package/_cjs/AsyncAction.cjs +0 -25
- package/_cjs/AsyncAction.cjs.map +1 -1
- package/_cjs/AsyncScheduler.cjs +2 -16
- package/_cjs/AsyncScheduler.cjs.map +1 -1
- package/_cjs/BehaviorSubject.cjs +0 -12
- package/_cjs/BehaviorSubject.cjs.map +1 -1
- package/_cjs/Notification.cjs +0 -23
- package/_cjs/Notification.cjs.map +1 -1
- package/_cjs/Observable/api/connect.cjs +0 -7
- package/_cjs/Observable/api/connect.cjs.map +1 -1
- package/_cjs/Observable/api/connectable.cjs +0 -14
- package/_cjs/Observable/api/connectable.cjs.map +1 -1
- package/_cjs/Observable/api/fromCallback.cjs +0 -15
- package/_cjs/Observable/api/fromCallback.cjs.map +1 -1
- package/_cjs/Observable/api/fromEvent.cjs +0 -5
- package/_cjs/Observable/api/fromEvent.cjs.map +1 -1
- package/_cjs/Observable/api/index.cjs +0 -28
- package/_cjs/Observable/api/index.cjs.map +1 -1
- package/_cjs/Observable/api/race.cjs +0 -10
- package/_cjs/Observable/api/race.cjs.map +1 -1
- package/_cjs/Observable/api/raceWith.cjs +0 -5
- package/_cjs/Observable/api/raceWith.cjs.map +1 -1
- package/_cjs/Observable/api/repeatWhen.cjs +0 -11
- package/_cjs/Observable/api/repeatWhen.cjs.map +1 -1
- package/_cjs/Observable/api/retryWhen.cjs +0 -9
- package/_cjs/Observable/api/retryWhen.cjs.map +1 -1
- package/_cjs/Observable/api/share.cjs +0 -18
- package/_cjs/Observable/api/share.cjs.map +1 -1
- package/_cjs/Observable/api/window.cjs +0 -8
- package/_cjs/Observable/api/window.cjs.map +1 -1
- package/_cjs/Observable/api/windowCount.cjs +0 -10
- package/_cjs/Observable/api/windowCount.cjs.map +1 -1
- package/_cjs/Observable/api/windowTime.cjs +0 -15
- package/_cjs/Observable/api/windowTime.cjs.map +1 -1
- package/_cjs/Observable/api/windowToggle.cjs +0 -18
- package/_cjs/Observable/api/windowToggle.cjs.map +1 -1
- package/_cjs/Observable/api/windowWhen.cjs +0 -12
- package/_cjs/Observable/api/windowWhen.cjs.map +1 -1
- package/_cjs/Observable/api.cjs +14 -404
- package/_cjs/Observable/api.cjs.map +1 -1
- package/_cjs/Observable/definition.cjs +0 -29
- package/_cjs/Observable/definition.cjs.map +1 -1
- package/_cjs/Observable/dom/animationFrames.cjs +0 -12
- package/_cjs/Observable/dom/animationFrames.cjs.map +1 -1
- package/_cjs/Observable.cjs +0 -38
- package/_cjs/Observable.cjs.map +1 -1
- package/_cjs/ObservableRef/api.cjs +160 -0
- package/_cjs/ObservableRef/api.cjs.map +1 -0
- package/_cjs/ObservableRef/atomic.cjs +93 -0
- package/_cjs/ObservableRef/atomic.cjs.map +1 -0
- package/_cjs/ObservableRef/definition.cjs +24 -0
- package/_cjs/ObservableRef/definition.cjs.map +1 -0
- package/_cjs/Operator.cjs +0 -12
- package/_cjs/Operator.cjs.map +1 -1
- package/_cjs/Scheduler.cjs +0 -13
- package/_cjs/Scheduler.cjs.map +1 -1
- package/_cjs/Subject.cjs +0 -47
- package/_cjs/Subject.cjs.map +1 -1
- package/_cjs/Subscriber.cjs +0 -32
- package/_cjs/Subscriber.cjs.map +1 -1
- package/_cjs/Subscription.cjs +0 -37
- package/_cjs/Subscription.cjs.map +1 -1
- package/_cjs/index.cjs +0 -28
- package/_cjs/internal/animationFrameProvider.cjs +0 -9
- package/_cjs/internal/animationFrameProvider.cjs.map +1 -1
- package/_cjs/internal/args.cjs +0 -6
- package/_cjs/internal/args.cjs.map +1 -1
- package/_cjs/internal/intervalProvider.cjs +0 -2
- package/_cjs/internal/intervalProvider.cjs.map +1 -1
- package/_cjs/internal/performanceTimestampProvider.cjs +0 -1
- package/_cjs/internal/performanceTimestampProvider.cjs.map +1 -1
- package/_cjs/internal/timeoutProvider.cjs +0 -2
- package/_cjs/internal/timeoutProvider.cjs.map +1 -1
- package/_cjs/internal/timestampProvider.cjs +0 -1
- package/_cjs/internal/timestampProvider.cjs.map +1 -1
- package/_cjs/internal/util.cjs +2 -21
- package/_cjs/internal/util.cjs.map +1 -1
- package/_mjs/Action.mjs +0 -3
- package/_mjs/Action.mjs.map +1 -1
- package/_mjs/AnimationFrameAction.mjs +0 -6
- package/_mjs/AnimationFrameAction.mjs.map +1 -1
- package/_mjs/AnimationFrameScheduler.mjs +0 -5
- package/_mjs/AnimationFrameScheduler.mjs.map +1 -1
- package/_mjs/AsyncAction.mjs +0 -17
- package/_mjs/AsyncAction.mjs.map +1 -1
- package/_mjs/AsyncScheduler.mjs +2 -10
- package/_mjs/AsyncScheduler.mjs.map +1 -1
- package/_mjs/BehaviorSubject.mjs +0 -7
- package/_mjs/BehaviorSubject.mjs.map +1 -1
- package/_mjs/Notification.mjs +0 -12
- package/_mjs/Notification.mjs.map +1 -1
- package/_mjs/Observable/api/connect.mjs +0 -1
- package/_mjs/Observable/api/connect.mjs.map +1 -1
- package/_mjs/Observable/api/connectable.mjs +0 -5
- package/_mjs/Observable/api/connectable.mjs.map +1 -1
- package/_mjs/Observable/api/fromCallback.mjs +0 -10
- package/_mjs/Observable/api/fromCallback.mjs.map +1 -1
- package/_mjs/Observable/api/fromEvent.mjs +0 -2
- package/_mjs/Observable/api/fromEvent.mjs.map +1 -1
- package/_mjs/Observable/api/index.mjs.map +1 -1
- package/_mjs/Observable/api/race.mjs +0 -4
- package/_mjs/Observable/api/race.mjs.map +1 -1
- package/_mjs/Observable/api/raceWith.mjs +0 -1
- package/_mjs/Observable/api/raceWith.mjs.map +1 -1
- package/_mjs/Observable/api/repeatWhen.mjs +0 -7
- package/_mjs/Observable/api/repeatWhen.mjs.map +1 -1
- package/_mjs/Observable/api/retryWhen.mjs +0 -5
- package/_mjs/Observable/api/retryWhen.mjs.map +1 -1
- package/_mjs/Observable/api/share.mjs +0 -12
- package/_mjs/Observable/api/share.mjs.map +1 -1
- package/_mjs/Observable/api/window.mjs +0 -3
- package/_mjs/Observable/api/window.mjs.map +1 -1
- package/_mjs/Observable/api/windowCount.mjs +0 -6
- package/_mjs/Observable/api/windowCount.mjs.map +1 -1
- package/_mjs/Observable/api/windowTime.mjs +0 -6
- package/_mjs/Observable/api/windowTime.mjs.map +1 -1
- package/_mjs/Observable/api/windowToggle.mjs +0 -10
- package/_mjs/Observable/api/windowToggle.mjs.map +1 -1
- package/_mjs/Observable/api/windowWhen.mjs +0 -6
- package/_mjs/Observable/api/windowWhen.mjs.map +1 -1
- package/_mjs/Observable/api.mjs +14 -306
- package/_mjs/Observable/api.mjs.map +1 -1
- package/_mjs/Observable/definition.mjs +0 -16
- package/_mjs/Observable/definition.mjs.map +1 -1
- package/_mjs/Observable/dom/animationFrames.mjs +0 -5
- package/_mjs/Observable/dom/animationFrames.mjs.map +1 -1
- package/_mjs/Observable.mjs +4 -4
- package/_mjs/Observable.mjs.map +1 -1
- package/_mjs/ObservableRef/api.mjs +141 -0
- package/_mjs/ObservableRef/api.mjs.map +1 -0
- package/_mjs/ObservableRef/atomic.mjs +82 -0
- package/_mjs/ObservableRef/atomic.mjs.map +1 -0
- package/_mjs/ObservableRef/definition.mjs +16 -0
- package/_mjs/ObservableRef/definition.mjs.map +1 -0
- package/_mjs/Operator.mjs +0 -3
- package/_mjs/Operator.mjs.map +1 -1
- package/_mjs/Scheduler.mjs +0 -3
- package/_mjs/Scheduler.mjs.map +1 -1
- package/_mjs/Subject.mjs +0 -34
- package/_mjs/Subject.mjs.map +1 -1
- package/_mjs/Subscriber.mjs +0 -20
- package/_mjs/Subscriber.mjs.map +1 -1
- package/_mjs/Subscription.mjs +0 -26
- package/_mjs/Subscription.mjs.map +1 -1
- package/_mjs/index.mjs.map +1 -1
- package/_mjs/internal/animationFrameProvider.mjs +0 -5
- package/_mjs/internal/animationFrameProvider.mjs.map +1 -1
- package/_mjs/internal/args.mjs +0 -2
- package/_mjs/internal/args.mjs.map +1 -1
- package/_mjs/internal/intervalProvider.mjs +0 -2
- package/_mjs/internal/intervalProvider.mjs.map +1 -1
- package/_mjs/internal/performanceTimestampProvider.mjs +0 -1
- package/_mjs/internal/performanceTimestampProvider.mjs.map +1 -1
- package/_mjs/internal/timeoutProvider.mjs +0 -2
- package/_mjs/internal/timeoutProvider.mjs.map +1 -1
- package/_mjs/internal/timestampProvider.mjs +0 -1
- package/_mjs/internal/timestampProvider.mjs.map +1 -1
- package/_mjs/internal/util.mjs +2 -7
- package/_mjs/internal/util.mjs.map +1 -1
- package/_src/Observable/api.ts +12 -11
- package/_src/ObservableRef/api.ts +169 -0
- package/_src/ObservableRef/atomic.ts +85 -0
- package/_src/ObservableRef/definition.ts +57 -0
- package/_src/global.ts +5 -1
- package/global.d.ts +5 -1
- package/package.json +2 -2
package/_mjs/Observable/api.mjs
CHANGED
|
@@ -78,14 +78,12 @@ import { caughtSchedule } from "@fncts/observable/Scheduler";
|
|
|
78
78
|
/**
|
|
79
79
|
* @tsplus static fncts.observable.ObservableOps halt
|
|
80
80
|
*/
|
|
81
|
-
|
|
82
81
|
export function halt(defect) {
|
|
83
82
|
return new Observable(s => s.error(tsplus_module_1.halt(defect)));
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
86
85
|
* @tsplus static fncts.observable.ObservableOps defer
|
|
87
86
|
*/
|
|
88
|
-
|
|
89
87
|
function defer_1(observable) {
|
|
90
88
|
return new Observable((s, environment) => {
|
|
91
89
|
from_1(observable()).provideEnvironment(environment).subscribe(s);
|
|
@@ -94,81 +92,62 @@ function defer_1(observable) {
|
|
|
94
92
|
/**
|
|
95
93
|
* @tsplus static fncts.observable.ObservableOps empty
|
|
96
94
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
95
|
function empty_1() {
|
|
100
96
|
return EMPTY;
|
|
101
97
|
}
|
|
102
98
|
/**
|
|
103
99
|
* @tsplus static fncts.observable.ObservableOps environmentWithObservable
|
|
104
100
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
101
|
function environmentWithObservable_1(f) {
|
|
108
102
|
return new EnvironmentWith(f);
|
|
109
103
|
}
|
|
110
104
|
/**
|
|
111
105
|
* @tsplus static fncts.observable.ObservableOps failCause
|
|
112
106
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
115
107
|
export function failCause(cause) {
|
|
116
108
|
return new Observable(s => s.error(cause));
|
|
117
109
|
}
|
|
118
110
|
/**
|
|
119
111
|
* @tsplus static fncts.observable.ObservableOps fail
|
|
120
112
|
*/
|
|
121
|
-
|
|
122
113
|
function fail_1(e) {
|
|
123
114
|
return new Observable(s => s.error(tsplus_module_1.fail(e)));
|
|
124
115
|
}
|
|
125
116
|
/**
|
|
126
117
|
* @tsplus static fncts.observable.ObservableOps from
|
|
127
118
|
*/
|
|
128
|
-
|
|
129
|
-
|
|
130
119
|
function from_1(input) {
|
|
131
120
|
if (input instanceof Observable) {
|
|
132
121
|
return input;
|
|
133
122
|
}
|
|
134
|
-
|
|
135
123
|
if (tsplus_module_2.isArrayLike(input)) {
|
|
136
124
|
return fromArrayLike(input);
|
|
137
125
|
}
|
|
138
|
-
|
|
139
126
|
if (tsplus_module_2.isPromiseLike(input)) {
|
|
140
127
|
return fromPromise(input);
|
|
141
128
|
}
|
|
142
|
-
|
|
143
129
|
if (tsplus_module_2.isAsyncIterable(input)) {
|
|
144
130
|
return fromAsyncIterable(input);
|
|
145
131
|
}
|
|
146
|
-
|
|
147
132
|
if (tsplus_module_3.isIterable(input)) {
|
|
148
133
|
return fromIterable(input);
|
|
149
134
|
}
|
|
150
|
-
|
|
151
135
|
if (tsplus_module_2.isReadableStream(input)) {
|
|
152
136
|
return fromReadableStreamLike(input);
|
|
153
137
|
}
|
|
154
|
-
|
|
155
138
|
if (tsplus_module_4.isIO(input)) {
|
|
156
139
|
return fromIO_1(input);
|
|
157
140
|
}
|
|
158
|
-
|
|
159
141
|
if ("subscribe" in input) {
|
|
160
142
|
return fromSubscribable_1(input);
|
|
161
143
|
}
|
|
162
|
-
|
|
163
144
|
throw new TypeError("Invalid Observable input");
|
|
164
145
|
}
|
|
165
|
-
|
|
166
146
|
export function fromArrayLike(input) {
|
|
167
147
|
return new Observable(s => {
|
|
168
148
|
for (let i = 0; i < input.length && !s.closed; i++) {
|
|
169
149
|
s.next(input[i]);
|
|
170
150
|
}
|
|
171
|
-
|
|
172
151
|
s.complete();
|
|
173
152
|
});
|
|
174
153
|
}
|
|
@@ -181,12 +160,10 @@ export function fromIterable(iterable) {
|
|
|
181
160
|
return new Observable(s => {
|
|
182
161
|
for (const value of iterable) {
|
|
183
162
|
s.next(value);
|
|
184
|
-
|
|
185
163
|
if (s.closed) {
|
|
186
164
|
return;
|
|
187
165
|
}
|
|
188
166
|
}
|
|
189
|
-
|
|
190
167
|
s.complete();
|
|
191
168
|
});
|
|
192
169
|
}
|
|
@@ -206,11 +183,9 @@ export function fromReadableStreamLike(readableStream) {
|
|
|
206
183
|
/**
|
|
207
184
|
* @tsplus static fncts.observable.ObservableOps fromSubscribable
|
|
208
185
|
*/
|
|
209
|
-
|
|
210
186
|
function fromSubscribable_1(subscribable) {
|
|
211
187
|
return new Observable(subscriber => subscribable.subscribe(subscriber));
|
|
212
188
|
}
|
|
213
|
-
|
|
214
189
|
export function fromInterop(subscribable) {
|
|
215
190
|
return new Observable(subscriber => subscribable.subscribe({
|
|
216
191
|
next: value => subscriber.next(value),
|
|
@@ -218,11 +193,9 @@ export function fromInterop(subscribable) {
|
|
|
218
193
|
complete: () => subscriber.complete()
|
|
219
194
|
}));
|
|
220
195
|
}
|
|
221
|
-
|
|
222
196
|
function _if(condition, onTrue, onFalse) {
|
|
223
197
|
return defer_1(() => condition() ? onTrue : onFalse);
|
|
224
198
|
}
|
|
225
|
-
|
|
226
199
|
export { _if as if };
|
|
227
200
|
export function iterate(options) {
|
|
228
201
|
const {
|
|
@@ -231,41 +204,32 @@ export function iterate(options) {
|
|
|
231
204
|
iterate,
|
|
232
205
|
scheduler
|
|
233
206
|
} = options;
|
|
234
|
-
|
|
235
207
|
function* gen() {
|
|
236
208
|
for (let state = initialState; !cont || cont(state); state = iterate(state)) {
|
|
237
209
|
yield state;
|
|
238
210
|
}
|
|
239
211
|
}
|
|
240
|
-
|
|
241
212
|
return defer_1(scheduler ? () => scheduleIterable(gen(), scheduler) : gen);
|
|
242
213
|
}
|
|
243
|
-
|
|
244
214
|
async function process(asyncIterable, subscriber) {
|
|
245
215
|
for await (const value of asyncIterable) {
|
|
246
216
|
subscriber.next(value);
|
|
247
|
-
|
|
248
217
|
if (subscriber.closed) {
|
|
249
218
|
return;
|
|
250
219
|
}
|
|
251
220
|
}
|
|
252
|
-
|
|
253
221
|
subscriber.complete();
|
|
254
222
|
}
|
|
255
223
|
/**
|
|
256
224
|
* @tsplus static fncts.obervable.ObservableOps interval
|
|
257
225
|
*/
|
|
258
|
-
|
|
259
|
-
|
|
260
226
|
function interval_1(period = 0, scheduler = tsplus_module_5.asyncScheduler) {
|
|
261
227
|
if (period < 0) {
|
|
262
228
|
// eslint-disable-next-line no-param-reassign
|
|
263
229
|
period = 0;
|
|
264
230
|
}
|
|
265
|
-
|
|
266
231
|
return timer_1(period, period, scheduler);
|
|
267
232
|
}
|
|
268
|
-
|
|
269
233
|
export function merge(...sources) {
|
|
270
234
|
const concurrency = popNumber(sources, Infinity);
|
|
271
235
|
return !sources.length ? empty_1() : sources.length === 1 ? from_1(sources[0]) : mergeAll_1(concurrency)(fromArrayLike(sources));
|
|
@@ -273,15 +237,12 @@ export function merge(...sources) {
|
|
|
273
237
|
/**
|
|
274
238
|
* @tsplus static fncts.observable.ObservableOps of
|
|
275
239
|
*/
|
|
276
|
-
|
|
277
240
|
function of_1(...items) {
|
|
278
241
|
return fromArrayLike(items);
|
|
279
242
|
}
|
|
280
243
|
/**
|
|
281
244
|
* @tsplus static fncts.observable.ObservableOps single
|
|
282
245
|
*/
|
|
283
|
-
|
|
284
|
-
|
|
285
246
|
function single_1(a) {
|
|
286
247
|
return new Observable(s => {
|
|
287
248
|
s.next(a);
|
|
@@ -292,34 +253,26 @@ function single_1(a) {
|
|
|
292
253
|
* @tsplus pipeable fncts.observable.Observable scheduled
|
|
293
254
|
* @tsplus static fncts.observable.ObservableOps scheduled
|
|
294
255
|
*/
|
|
295
|
-
|
|
296
|
-
|
|
297
256
|
function scheduled_1(scheduler) {
|
|
298
257
|
return input => {
|
|
299
258
|
if (tsplus_module_2.isArrayLike(input)) {
|
|
300
259
|
return scheduleArray(input, scheduler);
|
|
301
260
|
}
|
|
302
|
-
|
|
303
261
|
if (tsplus_module_2.isPromiseLike(input)) {
|
|
304
262
|
return schedulePromise(input, scheduler);
|
|
305
263
|
}
|
|
306
|
-
|
|
307
264
|
if (tsplus_module_3.isIterable(input)) {
|
|
308
265
|
return scheduleIterable(input, scheduler);
|
|
309
266
|
}
|
|
310
|
-
|
|
311
267
|
if (tsplus_module_2.isAsyncIterable(input)) {
|
|
312
268
|
return scheduleAsyncIterable(input, scheduler);
|
|
313
269
|
}
|
|
314
|
-
|
|
315
270
|
if (tsplus_module_2.isReadableStream(input)) {
|
|
316
271
|
return scheduleReadableStreamLike(input, scheduler);
|
|
317
272
|
}
|
|
318
|
-
|
|
319
273
|
return scheduleObservable(from_1(input), scheduler);
|
|
320
274
|
};
|
|
321
275
|
}
|
|
322
|
-
|
|
323
276
|
export function scheduleArray(input, scheduler) {
|
|
324
277
|
return new Observable(s => {
|
|
325
278
|
let i = 0;
|
|
@@ -328,7 +281,6 @@ export function scheduleArray(input, scheduler) {
|
|
|
328
281
|
s.complete();
|
|
329
282
|
} else {
|
|
330
283
|
s.next(input[i++]);
|
|
331
|
-
|
|
332
284
|
if (!s.closed) {
|
|
333
285
|
this.schedule();
|
|
334
286
|
}
|
|
@@ -365,7 +317,6 @@ export function scheduleIterable(input, scheduler) {
|
|
|
365
317
|
value,
|
|
366
318
|
done
|
|
367
319
|
} = iterator.next();
|
|
368
|
-
|
|
369
320
|
if (done) {
|
|
370
321
|
s.complete();
|
|
371
322
|
} else {
|
|
@@ -412,10 +363,8 @@ export function schedulePromise(input, scheduler) {
|
|
|
412
363
|
export function scheduleReadableStreamLike(input, scheduler) {
|
|
413
364
|
return scheduleAsyncIterable(readableStreamToAsyncGenerator(input), scheduler);
|
|
414
365
|
}
|
|
415
|
-
|
|
416
366
|
function timer_1(time = 0, intervalOrScheduler, scheduler = tsplus_module_5.asyncScheduler) {
|
|
417
367
|
let intervalDuration = -1;
|
|
418
|
-
|
|
419
368
|
if (intervalOrScheduler != null) {
|
|
420
369
|
if (tsplus_module_7.isScheduler(intervalOrScheduler)) {
|
|
421
370
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -424,19 +373,15 @@ function timer_1(time = 0, intervalOrScheduler, scheduler = tsplus_module_5.asyn
|
|
|
424
373
|
intervalDuration = intervalOrScheduler;
|
|
425
374
|
}
|
|
426
375
|
}
|
|
427
|
-
|
|
428
376
|
return new Observable(s => {
|
|
429
377
|
let due = tsplus_module_2.isValidDate(time) ? +time - scheduler.now() : time;
|
|
430
|
-
|
|
431
378
|
if (due < 0) {
|
|
432
379
|
due = 0;
|
|
433
380
|
}
|
|
434
|
-
|
|
435
381
|
let n = 0;
|
|
436
382
|
return scheduler.schedule(function () {
|
|
437
383
|
if (!s.closed) {
|
|
438
384
|
s.next(n++);
|
|
439
|
-
|
|
440
385
|
if (0 <= intervalDuration) {
|
|
441
386
|
this.schedule(undefined, intervalDuration);
|
|
442
387
|
} else {
|
|
@@ -449,8 +394,6 @@ function timer_1(time = 0, intervalOrScheduler, scheduler = tsplus_module_5.asyn
|
|
|
449
394
|
/**
|
|
450
395
|
* @tsplus static fncts.observable.ObservableOps zip
|
|
451
396
|
*/
|
|
452
|
-
|
|
453
|
-
|
|
454
397
|
export function makeZip(...sources) {
|
|
455
398
|
return sources.length ? new Observable((subscriber, environment) => {
|
|
456
399
|
let buffers = sources.map(() => []);
|
|
@@ -458,16 +401,13 @@ export function makeZip(...sources) {
|
|
|
458
401
|
subscriber.add(() => {
|
|
459
402
|
buffers = completed = null;
|
|
460
403
|
});
|
|
461
|
-
|
|
462
404
|
for (let sourceIndex = 0; !subscriber.closed && sourceIndex < sources.length; sourceIndex++) {
|
|
463
405
|
from_1(sources[sourceIndex]).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
464
406
|
next: value => {
|
|
465
407
|
buffers[sourceIndex].push(value);
|
|
466
|
-
|
|
467
408
|
if (buffers.every(buffer => buffer.length)) {
|
|
468
409
|
const result = buffers.map(buffer => buffer.shift());
|
|
469
410
|
subscriber.next(result);
|
|
470
|
-
|
|
471
411
|
if (buffers.some((buffer, i) => !buffer.length && completed[i])) {
|
|
472
412
|
subscriber.complete();
|
|
473
413
|
}
|
|
@@ -479,7 +419,6 @@ export function makeZip(...sources) {
|
|
|
479
419
|
}
|
|
480
420
|
}));
|
|
481
421
|
}
|
|
482
|
-
|
|
483
422
|
return () => {
|
|
484
423
|
buffers = completed = null;
|
|
485
424
|
};
|
|
@@ -488,35 +427,31 @@ export function makeZip(...sources) {
|
|
|
488
427
|
/**
|
|
489
428
|
* @tsplus static fncts.observable.ObservableOps fromIO
|
|
490
429
|
*/
|
|
491
|
-
|
|
492
430
|
function fromIO_1(io, scheduler = tsplus_module_5.asyncScheduler) {
|
|
493
431
|
return new Observable((s, env) => {
|
|
494
432
|
let fiber;
|
|
495
433
|
const scheduled = scheduler.schedule(() => {
|
|
496
434
|
fiber = tsplus_module_10.unsafeRunFiber(tsplus_module_9.provideEnvironment(env, fileName_1 + ":489:36")(io), fileName_1 + ":489:56");
|
|
497
|
-
fiber.
|
|
435
|
+
fiber.addObserver(exit => {
|
|
498
436
|
if (!s.closed) {
|
|
499
|
-
tsplus_module_11.match(cause => s.error(cause), a => s.next(a))(
|
|
437
|
+
tsplus_module_11.match(cause => s.error(cause), a => s.next(a))(exit);
|
|
500
438
|
s.complete();
|
|
501
439
|
}
|
|
502
440
|
});
|
|
503
441
|
});
|
|
504
442
|
return () => {
|
|
505
443
|
scheduled.unsubscribe();
|
|
506
|
-
fiber && tsplus_module_10.unsafeRunAsync(tsplus_module_12.interrupt(fiber
|
|
444
|
+
fiber && tsplus_module_10.unsafeRunAsync(tsplus_module_12.interrupt(fiber), fileName_1 + ":502:46");
|
|
507
445
|
};
|
|
508
446
|
});
|
|
509
447
|
}
|
|
510
448
|
/**
|
|
511
449
|
* @tsplus static fncts.observable.ObservableOps unit
|
|
512
450
|
*/
|
|
513
|
-
|
|
514
|
-
|
|
515
451
|
export const unit = /*#__PURE__*/single_1(undefined);
|
|
516
452
|
/**
|
|
517
453
|
* @tsplus pipeable fncts.observable.Observable zipWith
|
|
518
454
|
*/
|
|
519
|
-
|
|
520
455
|
function zipWith_1(fb, f) {
|
|
521
456
|
return fa => {
|
|
522
457
|
return mergeMap_1(a => map_1(b => f(a, b))(fb))(fa);
|
|
@@ -525,8 +460,6 @@ function zipWith_1(fb, f) {
|
|
|
525
460
|
/**
|
|
526
461
|
* @tsplus pipeable fncts.observable.Observable zip
|
|
527
462
|
*/
|
|
528
|
-
|
|
529
|
-
|
|
530
463
|
export function zip(fb) {
|
|
531
464
|
return fa => {
|
|
532
465
|
return zipWith_1(fb, tsplus_module_13.tuple)(fa);
|
|
@@ -535,7 +468,6 @@ export function zip(fb) {
|
|
|
535
468
|
/**
|
|
536
469
|
* @tsplus pipeable fncts.observable.Observable ap
|
|
537
470
|
*/
|
|
538
|
-
|
|
539
471
|
export function ap(fa) {
|
|
540
472
|
return fab => {
|
|
541
473
|
return zipWith_1(fa, (f, a) => f(a))(fab);
|
|
@@ -544,7 +476,6 @@ export function ap(fa) {
|
|
|
544
476
|
/**
|
|
545
477
|
* @tsplus pipeable fncts.observable.Observable mapWithIndex
|
|
546
478
|
*/
|
|
547
|
-
|
|
548
479
|
function mapWithIndex_1(f) {
|
|
549
480
|
return fa => {
|
|
550
481
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -560,8 +491,6 @@ function mapWithIndex_1(f) {
|
|
|
560
491
|
/**
|
|
561
492
|
* @tsplus pipeable fncts.observable.Observable map
|
|
562
493
|
*/
|
|
563
|
-
|
|
564
|
-
|
|
565
494
|
function map_1(f) {
|
|
566
495
|
return fa => {
|
|
567
496
|
return mapWithIndex_1((_, a) => f(a))(fa);
|
|
@@ -570,8 +499,6 @@ function map_1(f) {
|
|
|
570
499
|
/**
|
|
571
500
|
* @tsplus pipeable fncts.observable.Observable as
|
|
572
501
|
*/
|
|
573
|
-
|
|
574
|
-
|
|
575
502
|
function as_1(b) {
|
|
576
503
|
return fa => {
|
|
577
504
|
return map_1(b)(fa);
|
|
@@ -580,8 +507,6 @@ function as_1(b) {
|
|
|
580
507
|
/**
|
|
581
508
|
* @tsplus pipeable fncts.observable.Observable mapError
|
|
582
509
|
*/
|
|
583
|
-
|
|
584
|
-
|
|
585
510
|
export function mapError(f) {
|
|
586
511
|
return fa => {
|
|
587
512
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -596,7 +521,6 @@ export function mapError(f) {
|
|
|
596
521
|
/**
|
|
597
522
|
* @tsplus getter fncts.observable.Observable swap
|
|
598
523
|
*/
|
|
599
|
-
|
|
600
524
|
export function swap(fa) {
|
|
601
525
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
602
526
|
source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
@@ -613,7 +537,6 @@ export function swap(fa) {
|
|
|
613
537
|
}));
|
|
614
538
|
})(fa);
|
|
615
539
|
}
|
|
616
|
-
|
|
617
540
|
function filterWithIndex_1(predicate) {
|
|
618
541
|
return fa => {
|
|
619
542
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -624,7 +547,6 @@ function filterWithIndex_1(predicate) {
|
|
|
624
547
|
})(fa);
|
|
625
548
|
};
|
|
626
549
|
}
|
|
627
|
-
|
|
628
550
|
export function filter(predicate) {
|
|
629
551
|
return fa => {
|
|
630
552
|
return filterWithIndex_1((_, a) => predicate(a))(fa);
|
|
@@ -633,7 +555,6 @@ export function filter(predicate) {
|
|
|
633
555
|
/**
|
|
634
556
|
* @tsplus pipeable fncts.observable.Observable filterMapWithIndex
|
|
635
557
|
*/
|
|
636
|
-
|
|
637
558
|
function filterMapWithIndex_1(f) {
|
|
638
559
|
return fa => {
|
|
639
560
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -647,20 +568,16 @@ function filterMapWithIndex_1(f) {
|
|
|
647
568
|
/**
|
|
648
569
|
* @tsplus pipeable fncts.observable.Observable filterMap
|
|
649
570
|
*/
|
|
650
|
-
|
|
651
|
-
|
|
652
571
|
export function filterMap(f) {
|
|
653
572
|
return fa => {
|
|
654
573
|
return filterMapWithIndex_1((_, a) => f(a))(fa);
|
|
655
574
|
};
|
|
656
575
|
}
|
|
657
|
-
|
|
658
576
|
function partitionWithIndex_1(predicate) {
|
|
659
577
|
return fa => {
|
|
660
578
|
return [filterWithIndex_1((i, a) => !predicate(i, a))(fa), filterWithIndex_1(predicate)(fa)];
|
|
661
579
|
};
|
|
662
580
|
}
|
|
663
|
-
|
|
664
581
|
export function partition(predicate) {
|
|
665
582
|
return fa => {
|
|
666
583
|
return partitionWithIndex_1((_, a) => predicate(a))(fa);
|
|
@@ -669,7 +586,6 @@ export function partition(predicate) {
|
|
|
669
586
|
/**
|
|
670
587
|
* @tsplus pipeable fncts.observable.Observable partitionMapWithIndex
|
|
671
588
|
*/
|
|
672
|
-
|
|
673
589
|
function partitionMapWithIndex_1(f) {
|
|
674
590
|
return fa => {
|
|
675
591
|
return [tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -692,8 +608,6 @@ function partitionMapWithIndex_1(f) {
|
|
|
692
608
|
/**
|
|
693
609
|
* @tsplus pipeable fncts.observable.Observable partitionMap
|
|
694
610
|
*/
|
|
695
|
-
|
|
696
|
-
|
|
697
611
|
export function partitionMap(f) {
|
|
698
612
|
return fa => {
|
|
699
613
|
return partitionMapWithIndex_1((_, a) => f(a))(fa);
|
|
@@ -702,10 +616,7 @@ export function partitionMap(f) {
|
|
|
702
616
|
/**
|
|
703
617
|
* @tsplus pipeable fncts.observable.Observable provideService
|
|
704
618
|
*/
|
|
705
|
-
|
|
706
|
-
export function provideService(service,
|
|
707
|
-
/** @tsplus auto */
|
|
708
|
-
tag) {
|
|
619
|
+
export function provideService(service, /** @tsplus auto */tag) {
|
|
709
620
|
return self => {
|
|
710
621
|
return contramapEnvironment_1(environment => tsplus_module_16.add(service, tag)(environment))(self);
|
|
711
622
|
};
|
|
@@ -713,7 +624,6 @@ tag) {
|
|
|
713
624
|
/**
|
|
714
625
|
* @tsplus pipeable fncts.observable.Observable mergeMapWithIndex
|
|
715
626
|
*/
|
|
716
|
-
|
|
717
627
|
function mergeMapWithIndex_1(f, concurrent = Infinity) {
|
|
718
628
|
return ma => {
|
|
719
629
|
return tsplus_module_8.operate_((source, sub, environment) => mergeInternal(source, sub, environment, f, concurrent))(ma);
|
|
@@ -722,8 +632,6 @@ function mergeMapWithIndex_1(f, concurrent = Infinity) {
|
|
|
722
632
|
/**
|
|
723
633
|
* @tsplus pipeable fncts.observable.Observable mergeMap
|
|
724
634
|
*/
|
|
725
|
-
|
|
726
|
-
|
|
727
635
|
function mergeMap_1(f, concurrent = Infinity) {
|
|
728
636
|
return ma => {
|
|
729
637
|
return mergeMapWithIndex_1((_, a) => f(a), concurrent)(ma);
|
|
@@ -732,8 +640,6 @@ function mergeMap_1(f, concurrent = Infinity) {
|
|
|
732
640
|
/**
|
|
733
641
|
* @tsplus pipeable fncts.observable.Observable concatMapWithIndex
|
|
734
642
|
*/
|
|
735
|
-
|
|
736
|
-
|
|
737
643
|
export function concatMapWithIndex(f) {
|
|
738
644
|
return ma => {
|
|
739
645
|
return mergeMapWithIndex_1(f, 1)(ma);
|
|
@@ -742,7 +648,6 @@ export function concatMapWithIndex(f) {
|
|
|
742
648
|
/**
|
|
743
649
|
* @tsplus pipeable fncts.observable.Observable concatMap
|
|
744
650
|
*/
|
|
745
|
-
|
|
746
651
|
export function concatMap(f) {
|
|
747
652
|
return ma => {
|
|
748
653
|
return mergeMapWithIndex_1((_, a) => f(a), 1)(ma);
|
|
@@ -751,7 +656,6 @@ export function concatMap(f) {
|
|
|
751
656
|
/**
|
|
752
657
|
* @tsplus pipeable fncts.observable.Observable contramapEnvironment
|
|
753
658
|
*/
|
|
754
|
-
|
|
755
659
|
function contramapEnvironment_1(f) {
|
|
756
660
|
return self => {
|
|
757
661
|
return environmentWithObservable_1(environment => self.provideEnvironment(f(environment)));
|
|
@@ -760,15 +664,12 @@ function contramapEnvironment_1(f) {
|
|
|
760
664
|
/**
|
|
761
665
|
* @tsplus getter fncts.observable.Observable flatten
|
|
762
666
|
*/
|
|
763
|
-
|
|
764
|
-
|
|
765
667
|
export function flatten(mma) {
|
|
766
668
|
return concatAll_1(mma);
|
|
767
669
|
}
|
|
768
670
|
/**
|
|
769
671
|
* @tsplus pipeable fncts.observable.Observable foldLeftWithIndex
|
|
770
672
|
*/
|
|
771
|
-
|
|
772
673
|
function foldLeftWithIndex_1(initial, f) {
|
|
773
674
|
return fa => {
|
|
774
675
|
return tsplus_module_8.operate_(scanInternal(f, initial, true, false, true))(fa);
|
|
@@ -777,8 +678,6 @@ function foldLeftWithIndex_1(initial, f) {
|
|
|
777
678
|
/**
|
|
778
679
|
* @tsplus pipeable fncts.observable.Observable foldLeft
|
|
779
680
|
*/
|
|
780
|
-
|
|
781
|
-
|
|
782
681
|
function foldLeft_1(initial, f) {
|
|
783
682
|
return fa => {
|
|
784
683
|
return foldLeftWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
|
|
@@ -787,8 +686,6 @@ function foldLeft_1(initial, f) {
|
|
|
787
686
|
/**
|
|
788
687
|
* @tsplus pipeable fncts.observable.Observable at
|
|
789
688
|
*/
|
|
790
|
-
|
|
791
|
-
|
|
792
689
|
export function at(index) {
|
|
793
690
|
return fa => {
|
|
794
691
|
return onEmpty_1(() => tsplus_module_17.nothing())(map_1(tsplus_module_17.just)(take_1(1)(filterWithIndex_1(i => i === index)(fa))));
|
|
@@ -797,18 +694,15 @@ export function at(index) {
|
|
|
797
694
|
/**
|
|
798
695
|
* @tsplus pipeable fncts.observable.Observable audit
|
|
799
696
|
*/
|
|
800
|
-
|
|
801
697
|
function audit_1(durationSelector) {
|
|
802
698
|
return fa => {
|
|
803
699
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
804
700
|
let lastValue = tsplus_module_17.nothing();
|
|
805
701
|
let durationSubscriber = null;
|
|
806
702
|
let isComplete = false;
|
|
807
|
-
|
|
808
703
|
const endDuration = () => {
|
|
809
704
|
durationSubscriber?.unsubscribe();
|
|
810
705
|
durationSubscriber = null;
|
|
811
|
-
|
|
812
706
|
if (tsplus_module_18.isJust(lastValue)) {
|
|
813
707
|
const {
|
|
814
708
|
value
|
|
@@ -816,19 +710,15 @@ function audit_1(durationSelector) {
|
|
|
816
710
|
lastValue = tsplus_module_17.nothing();
|
|
817
711
|
subscriber.next(value);
|
|
818
712
|
}
|
|
819
|
-
|
|
820
713
|
isComplete && subscriber.complete();
|
|
821
714
|
};
|
|
822
|
-
|
|
823
715
|
const cleanupDuration = () => {
|
|
824
716
|
durationSubscriber = null;
|
|
825
717
|
isComplete && subscriber.complete();
|
|
826
718
|
};
|
|
827
|
-
|
|
828
719
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
829
720
|
next: value => {
|
|
830
721
|
lastValue = tsplus_module_17.just(value);
|
|
831
|
-
|
|
832
722
|
if (!durationSubscriber) {
|
|
833
723
|
from_1(durationSelector(value)).provideEnvironment(environment).subscribe(durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
834
724
|
next: endDuration,
|
|
@@ -847,8 +737,6 @@ function audit_1(durationSelector) {
|
|
|
847
737
|
/**
|
|
848
738
|
* @tsplus pipeable fncts.observable.Observable auditTime
|
|
849
739
|
*/
|
|
850
|
-
|
|
851
|
-
|
|
852
740
|
export function auditTime(duration, scheduler = tsplus_module_5.asyncScheduler) {
|
|
853
741
|
return fa => {
|
|
854
742
|
return audit_1(() => timer_1(duration, scheduler))(fa);
|
|
@@ -857,7 +745,6 @@ export function auditTime(duration, scheduler = tsplus_module_5.asyncScheduler)
|
|
|
857
745
|
/**
|
|
858
746
|
* @tsplus pipeable fncts.observable.Observable buffer
|
|
859
747
|
*/
|
|
860
|
-
|
|
861
748
|
export function buffer(closingNotifier) {
|
|
862
749
|
return fa => {
|
|
863
750
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -886,7 +773,6 @@ export function buffer(closingNotifier) {
|
|
|
886
773
|
/**
|
|
887
774
|
* @tsplus pipeable fncts.observable.Observable bufferCount
|
|
888
775
|
*/
|
|
889
|
-
|
|
890
776
|
export function bufferCount(bufferSize, startBufferEvery) {
|
|
891
777
|
return fa => {
|
|
892
778
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -897,20 +783,16 @@ export function bufferCount(bufferSize, startBufferEvery) {
|
|
|
897
783
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
898
784
|
next: value => {
|
|
899
785
|
let toEmit = null;
|
|
900
|
-
|
|
901
786
|
if (count++ % startBufferEvery === 0) {
|
|
902
787
|
buffers.push([]);
|
|
903
788
|
}
|
|
904
|
-
|
|
905
789
|
for (const buffer of buffers) {
|
|
906
790
|
buffer.push(value);
|
|
907
|
-
|
|
908
791
|
if (bufferSize <= buffer.length) {
|
|
909
792
|
toEmit = toEmit ?? [];
|
|
910
793
|
toEmit.push(buffer);
|
|
911
794
|
}
|
|
912
795
|
}
|
|
913
|
-
|
|
914
796
|
if (toEmit) {
|
|
915
797
|
for (const buffer of toEmit) {
|
|
916
798
|
arrayRemove(buffers, buffer);
|
|
@@ -922,7 +804,6 @@ export function bufferCount(bufferSize, startBufferEvery) {
|
|
|
922
804
|
for (const buffer of buffers) {
|
|
923
805
|
subscriber.next(buffer);
|
|
924
806
|
}
|
|
925
|
-
|
|
926
807
|
subscriber.complete();
|
|
927
808
|
}
|
|
928
809
|
}, () => {
|
|
@@ -934,7 +815,6 @@ export function bufferCount(bufferSize, startBufferEvery) {
|
|
|
934
815
|
/**
|
|
935
816
|
* @tsplus pipeable fncts.observable.Observable bufferTime
|
|
936
817
|
*/
|
|
937
|
-
|
|
938
818
|
export function bufferTime(config) {
|
|
939
819
|
return fa => {
|
|
940
820
|
const {
|
|
@@ -946,7 +826,6 @@ export function bufferTime(config) {
|
|
|
946
826
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
947
827
|
let bufferRecords = [];
|
|
948
828
|
let restartOnEmit = true;
|
|
949
|
-
|
|
950
829
|
const emit = record => {
|
|
951
830
|
const {
|
|
952
831
|
buffer,
|
|
@@ -957,7 +836,6 @@ export function bufferTime(config) {
|
|
|
957
836
|
subscriber.next(buffer);
|
|
958
837
|
restartOnEmit && startBuffer();
|
|
959
838
|
};
|
|
960
|
-
|
|
961
839
|
const startBuffer = () => {
|
|
962
840
|
if (bufferRecords) {
|
|
963
841
|
const subs = new tsplus_module_6.Subscription();
|
|
@@ -971,7 +849,6 @@ export function bufferTime(config) {
|
|
|
971
849
|
subs.add(scheduler.schedule(() => emit(record), bufferTimeSpan));
|
|
972
850
|
}
|
|
973
851
|
};
|
|
974
|
-
|
|
975
852
|
bufferCreationInterval !== null && bufferCreationInterval >= 0 ? subscriber.add(scheduler.schedule(function () {
|
|
976
853
|
startBuffer();
|
|
977
854
|
!this.closed && subscriber.add(this.schedule(null, bufferCreationInterval));
|
|
@@ -980,7 +857,6 @@ export function bufferTime(config) {
|
|
|
980
857
|
const bufferTimeSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
981
858
|
next: value => {
|
|
982
859
|
const recordsCopy = bufferRecords.slice();
|
|
983
|
-
|
|
984
860
|
for (const record of recordsCopy) {
|
|
985
861
|
const {
|
|
986
862
|
buffer
|
|
@@ -993,7 +869,6 @@ export function bufferTime(config) {
|
|
|
993
869
|
while (bufferRecords?.length) {
|
|
994
870
|
subscriber.next(bufferRecords.shift().buffer);
|
|
995
871
|
}
|
|
996
|
-
|
|
997
872
|
bufferTimeSubscriber?.unsubscribe();
|
|
998
873
|
subscriber.complete();
|
|
999
874
|
subscriber.unsubscribe();
|
|
@@ -1006,7 +881,6 @@ export function bufferTime(config) {
|
|
|
1006
881
|
/**
|
|
1007
882
|
* @tsplus pipeable fncts.observable.Observable bufferToggle
|
|
1008
883
|
*/
|
|
1009
|
-
|
|
1010
884
|
export function bufferToggle(openings, closingSelector) {
|
|
1011
885
|
return fa => {
|
|
1012
886
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1016,13 +890,11 @@ export function bufferToggle(openings, closingSelector) {
|
|
|
1016
890
|
const buffer = [];
|
|
1017
891
|
buffers.push(buffer);
|
|
1018
892
|
const closingSubscription = new tsplus_module_6.Subscription();
|
|
1019
|
-
|
|
1020
893
|
const emitBuffer = () => {
|
|
1021
894
|
arrayRemove(buffers, buffer);
|
|
1022
895
|
subscriber.next(buffer);
|
|
1023
896
|
closingSubscription.unsubscribe();
|
|
1024
897
|
};
|
|
1025
|
-
|
|
1026
898
|
closingSubscription.add(from_1(closingSelector(openValue)).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1027
899
|
next: emitBuffer,
|
|
1028
900
|
complete: tsplus_module_2.noop
|
|
@@ -1040,7 +912,6 @@ export function bufferToggle(openings, closingSelector) {
|
|
|
1040
912
|
while (buffers.length > 0) {
|
|
1041
913
|
subscriber.next(buffers.shift());
|
|
1042
914
|
}
|
|
1043
|
-
|
|
1044
915
|
subscriber.complete();
|
|
1045
916
|
}
|
|
1046
917
|
}));
|
|
@@ -1050,13 +921,11 @@ export function bufferToggle(openings, closingSelector) {
|
|
|
1050
921
|
/**
|
|
1051
922
|
* @tsplus pipeable fncts.observable.Observable bufferWhen
|
|
1052
923
|
*/
|
|
1053
|
-
|
|
1054
924
|
export function bufferWhen(closingSelector) {
|
|
1055
925
|
return fa => {
|
|
1056
926
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1057
927
|
let buffer = null;
|
|
1058
928
|
let closingSubscriber = null;
|
|
1059
|
-
|
|
1060
929
|
const openBuffer = () => {
|
|
1061
930
|
closingSubscriber?.unsubscribe();
|
|
1062
931
|
const b = buffer;
|
|
@@ -1067,7 +936,6 @@ export function bufferWhen(closingSelector) {
|
|
|
1067
936
|
complete: tsplus_module_2.noop
|
|
1068
937
|
}));
|
|
1069
938
|
};
|
|
1070
|
-
|
|
1071
939
|
openBuffer();
|
|
1072
940
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1073
941
|
next: value => buffer?.push(value),
|
|
@@ -1082,7 +950,6 @@ export function bufferWhen(closingSelector) {
|
|
|
1082
950
|
/**
|
|
1083
951
|
* @tsplus pipeable fncts.observable.Observable catchAllCause
|
|
1084
952
|
*/
|
|
1085
|
-
|
|
1086
953
|
function catchAllCause_1(f) {
|
|
1087
954
|
return self => {
|
|
1088
955
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1092,7 +959,6 @@ function catchAllCause_1(f) {
|
|
|
1092
959
|
innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1093
960
|
error: cause => {
|
|
1094
961
|
handledResult = from_1(f(cause, catchAllCause_1(f)(source)));
|
|
1095
|
-
|
|
1096
962
|
if (innerSub) {
|
|
1097
963
|
innerSub.unsubscribe();
|
|
1098
964
|
innerSub = null;
|
|
@@ -1102,7 +968,6 @@ function catchAllCause_1(f) {
|
|
|
1102
968
|
}
|
|
1103
969
|
}
|
|
1104
970
|
}));
|
|
1105
|
-
|
|
1106
971
|
if (syncUnsub) {
|
|
1107
972
|
innerSub.unsubscribe();
|
|
1108
973
|
innerSub = null;
|
|
@@ -1114,16 +979,12 @@ function catchAllCause_1(f) {
|
|
|
1114
979
|
/**
|
|
1115
980
|
* @tsplus getter fncts.observable.Observable concatAll
|
|
1116
981
|
*/
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
982
|
function concatAll_1(ffa) {
|
|
1120
983
|
return mergeAll_1(1)(ffa);
|
|
1121
984
|
}
|
|
1122
985
|
/**
|
|
1123
986
|
* @tsplus pipeable fncts.observable.Observable concat
|
|
1124
987
|
*/
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
988
|
function concat_1(...sources) {
|
|
1128
989
|
return fa => {
|
|
1129
990
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1134,15 +995,12 @@ function concat_1(...sources) {
|
|
|
1134
995
|
/**
|
|
1135
996
|
* @tsplus getter fncts.observable.Observable count
|
|
1136
997
|
*/
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
998
|
export function count(fa) {
|
|
1140
999
|
return foldLeft_1(0, (total, _) => total + 1)(fa);
|
|
1141
1000
|
}
|
|
1142
1001
|
/**
|
|
1143
1002
|
* @tsplus pipeable fncts.observable.Observable countWithIndex
|
|
1144
1003
|
*/
|
|
1145
|
-
|
|
1146
1004
|
function countWithIndex_1(predicate) {
|
|
1147
1005
|
return fa => {
|
|
1148
1006
|
return foldLeftWithIndex_1(0, (i, total, v) => predicate(i, v) ? total + 1 : total)(fa);
|
|
@@ -1151,8 +1009,6 @@ function countWithIndex_1(predicate) {
|
|
|
1151
1009
|
/**
|
|
1152
1010
|
* @tsplus pipeable fncts.observable.Observable countWith
|
|
1153
1011
|
*/
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
1012
|
export function countWith(predicate) {
|
|
1157
1013
|
return fa => {
|
|
1158
1014
|
return countWithIndex_1((_, a) => predicate(a))(fa);
|
|
@@ -1161,20 +1017,17 @@ export function countWith(predicate) {
|
|
|
1161
1017
|
/**
|
|
1162
1018
|
* @tsplus getter fncts.observable.Observable combineLatestAll
|
|
1163
1019
|
*/
|
|
1164
|
-
|
|
1165
1020
|
export function combineLatestAll(fa) {
|
|
1166
1021
|
return joinAllInternal(fa, sources => !sources.length ? empty_1() : zipLatest_1(sources[0], ...sources.slice(1)));
|
|
1167
1022
|
}
|
|
1168
1023
|
/**
|
|
1169
1024
|
* @tsplus pipeable fncts.observable.Observable zipLatest
|
|
1170
1025
|
*/
|
|
1171
|
-
|
|
1172
1026
|
function zipLatest_1(...sources) {
|
|
1173
1027
|
return self => {
|
|
1174
1028
|
if (!sources.length) {
|
|
1175
1029
|
return from_1(self).unsafeCoerce();
|
|
1176
1030
|
}
|
|
1177
|
-
|
|
1178
1031
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1179
1032
|
combineLatestInternal(subscriber, environment, [source, ...sources]);
|
|
1180
1033
|
})(from_1(self));
|
|
@@ -1183,8 +1036,6 @@ function zipLatest_1(...sources) {
|
|
|
1183
1036
|
/**
|
|
1184
1037
|
* @tsplus pipeable fncts.observable.Observable zipWithLatest
|
|
1185
1038
|
*/
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
1039
|
export function zipWithLatest(that, f) {
|
|
1189
1040
|
return self => {
|
|
1190
1041
|
return map_1(tsplus_module_13.tupled(f))(zipLatest_1(from_1(that))(self));
|
|
@@ -1193,17 +1044,14 @@ export function zipWithLatest(that, f) {
|
|
|
1193
1044
|
/**
|
|
1194
1045
|
* @tsplus pipeable fncts.observable.Observable debounceWith
|
|
1195
1046
|
*/
|
|
1196
|
-
|
|
1197
1047
|
export function debounceWith(durationSelector) {
|
|
1198
1048
|
return fa => {
|
|
1199
1049
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1200
1050
|
let lastValue = tsplus_module_17.nothing();
|
|
1201
1051
|
let durationSubscriber = null;
|
|
1202
|
-
|
|
1203
1052
|
const emit = () => {
|
|
1204
1053
|
durationSubscriber?.unsubscribe();
|
|
1205
1054
|
durationSubscriber = null;
|
|
1206
|
-
|
|
1207
1055
|
if (tsplus_module_18.isJust(lastValue)) {
|
|
1208
1056
|
const {
|
|
1209
1057
|
value
|
|
@@ -1212,7 +1060,6 @@ export function debounceWith(durationSelector) {
|
|
|
1212
1060
|
subscriber.next(value);
|
|
1213
1061
|
}
|
|
1214
1062
|
};
|
|
1215
|
-
|
|
1216
1063
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1217
1064
|
next: value => {
|
|
1218
1065
|
durationSubscriber?.unsubscribe();
|
|
@@ -1236,14 +1083,12 @@ export function debounceWith(durationSelector) {
|
|
|
1236
1083
|
/**
|
|
1237
1084
|
* @tsplus pipeable fncts.observable.Observable debounce
|
|
1238
1085
|
*/
|
|
1239
|
-
|
|
1240
1086
|
export function debounce(dueTime, scheduler = tsplus_module_5.asyncScheduler) {
|
|
1241
1087
|
return fa => {
|
|
1242
1088
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1243
1089
|
let activeTask = null;
|
|
1244
1090
|
let lastValue = null;
|
|
1245
1091
|
let lastTime = null;
|
|
1246
|
-
|
|
1247
1092
|
const emit = () => {
|
|
1248
1093
|
if (activeTask) {
|
|
1249
1094
|
activeTask.unsubscribe();
|
|
@@ -1253,25 +1098,20 @@ export function debounce(dueTime, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
1253
1098
|
subscriber.next(value);
|
|
1254
1099
|
}
|
|
1255
1100
|
};
|
|
1256
|
-
|
|
1257
1101
|
function emitWhenIdle() {
|
|
1258
1102
|
const targetTime = lastTime + dueTime;
|
|
1259
1103
|
const now = scheduler.now();
|
|
1260
|
-
|
|
1261
1104
|
if (now < targetTime) {
|
|
1262
1105
|
activeTask = this.schedule(undefined, targetTime - now);
|
|
1263
1106
|
subscriber.add(activeTask);
|
|
1264
1107
|
return;
|
|
1265
1108
|
}
|
|
1266
|
-
|
|
1267
1109
|
emit();
|
|
1268
1110
|
}
|
|
1269
|
-
|
|
1270
1111
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1271
1112
|
next: value => {
|
|
1272
1113
|
lastValue = value;
|
|
1273
1114
|
lastTime = scheduler.now();
|
|
1274
|
-
|
|
1275
1115
|
if (!activeTask) {
|
|
1276
1116
|
activeTask = scheduler.schedule(emitWhenIdle, dueTime);
|
|
1277
1117
|
subscriber.add(activeTask);
|
|
@@ -1290,7 +1130,6 @@ export function debounce(dueTime, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
1290
1130
|
/**
|
|
1291
1131
|
* @tsplus getter fncts.observable.Observable either
|
|
1292
1132
|
*/
|
|
1293
|
-
|
|
1294
1133
|
export function either(fa) {
|
|
1295
1134
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1296
1135
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
@@ -1306,7 +1145,6 @@ export function either(fa) {
|
|
|
1306
1145
|
/**
|
|
1307
1146
|
* @tsplus pipeable fncts.observable.Observable delayWithIndex
|
|
1308
1147
|
*/
|
|
1309
|
-
|
|
1310
1148
|
function delayWithIndex_1(f) {
|
|
1311
1149
|
return fa => {
|
|
1312
1150
|
return mergeMapWithIndex_1((i, a) => as_1(() => a)(take_1(1)(f(i, a))))(fa);
|
|
@@ -1315,8 +1153,6 @@ function delayWithIndex_1(f) {
|
|
|
1315
1153
|
/**
|
|
1316
1154
|
* @tsplus pipeable fncts.observable.Observable delayWith
|
|
1317
1155
|
*/
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
1156
|
function delayWith_1(f) {
|
|
1321
1157
|
return fa => {
|
|
1322
1158
|
return delayWithIndex_1((_, a) => f(a))(fa);
|
|
@@ -1325,8 +1161,6 @@ function delayWith_1(f) {
|
|
|
1325
1161
|
/**
|
|
1326
1162
|
* @tsplus pipeable fncts.observable.Observable delay
|
|
1327
1163
|
*/
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
1164
|
export function delay(due, scheduler = tsplus_module_5.asyncScheduler) {
|
|
1331
1165
|
return fa => {
|
|
1332
1166
|
const duration = timer_1(due, scheduler);
|
|
@@ -1336,7 +1170,6 @@ export function delay(due, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
1336
1170
|
/**
|
|
1337
1171
|
* @tsplus getter fncts.observable.Observable dematerialize
|
|
1338
1172
|
*/
|
|
1339
|
-
|
|
1340
1173
|
export function dematerialize(fa) {
|
|
1341
1174
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1342
1175
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
@@ -1347,7 +1180,6 @@ export function dematerialize(fa) {
|
|
|
1347
1180
|
/**
|
|
1348
1181
|
* @tsplus pipeable fncts.observable.Observable ensuring
|
|
1349
1182
|
*/
|
|
1350
|
-
|
|
1351
1183
|
export function ensuring(finalizer) {
|
|
1352
1184
|
return fa => {
|
|
1353
1185
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1359,7 +1191,6 @@ export function ensuring(finalizer) {
|
|
|
1359
1191
|
/**
|
|
1360
1192
|
* @tsplus getter fncts.observable.Observable exhaustAll
|
|
1361
1193
|
*/
|
|
1362
|
-
|
|
1363
1194
|
export function exhaustAll(ffa) {
|
|
1364
1195
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1365
1196
|
let isComplete = false;
|
|
@@ -1385,7 +1216,6 @@ export function exhaustAll(ffa) {
|
|
|
1385
1216
|
/**
|
|
1386
1217
|
* @tsplus pipeable fncts.observable.Observable exhaustMapWithIndex
|
|
1387
1218
|
*/
|
|
1388
|
-
|
|
1389
1219
|
function exhaustMapWithIndex_1(f) {
|
|
1390
1220
|
return self => {
|
|
1391
1221
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1415,8 +1245,6 @@ function exhaustMapWithIndex_1(f) {
|
|
|
1415
1245
|
/**
|
|
1416
1246
|
* @tsplus pipeable fncts.observable.Observable exhaustMap
|
|
1417
1247
|
*/
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
1248
|
export function exhaustMap(f) {
|
|
1421
1249
|
return self => {
|
|
1422
1250
|
return exhaustMapWithIndex_1((_, a) => f(a))(self);
|
|
@@ -1425,7 +1253,6 @@ export function exhaustMap(f) {
|
|
|
1425
1253
|
/**
|
|
1426
1254
|
* @tsplus pipeable fncts.observable.Observable expandWithIndex
|
|
1427
1255
|
*/
|
|
1428
|
-
|
|
1429
1256
|
function expandWithIndex_1(f, concurrent = Infinity) {
|
|
1430
1257
|
return fa => {
|
|
1431
1258
|
concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
|
|
@@ -1435,32 +1262,26 @@ function expandWithIndex_1(f, concurrent = Infinity) {
|
|
|
1435
1262
|
/**
|
|
1436
1263
|
* @tsplus pipeable fncts.observable.Observable expand
|
|
1437
1264
|
*/
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
1265
|
export function expand(f, concurrent = Infinity) {
|
|
1441
1266
|
return fa => {
|
|
1442
1267
|
return expandWithIndex_1((_, a) => f(a), concurrent)(fa);
|
|
1443
1268
|
};
|
|
1444
1269
|
}
|
|
1445
|
-
|
|
1446
1270
|
function findWithIndex_1(predicate) {
|
|
1447
1271
|
return fa => {
|
|
1448
1272
|
return tsplus_module_8.operate_(findInternal(predicate, "value"))(fa);
|
|
1449
1273
|
};
|
|
1450
1274
|
}
|
|
1451
|
-
|
|
1452
1275
|
export function find(predicate) {
|
|
1453
1276
|
return fa => {
|
|
1454
1277
|
return findWithIndex_1((_, a) => predicate(a))(fa);
|
|
1455
1278
|
};
|
|
1456
1279
|
}
|
|
1457
|
-
|
|
1458
1280
|
function findIndexWithIndex_1(predicate) {
|
|
1459
1281
|
return fa => {
|
|
1460
1282
|
return tsplus_module_8.operate_(findInternal(predicate, "index"))(fa);
|
|
1461
1283
|
};
|
|
1462
1284
|
}
|
|
1463
|
-
|
|
1464
1285
|
export function findIndex(predicate) {
|
|
1465
1286
|
return fa => {
|
|
1466
1287
|
return findIndexWithIndex_1((_, a) => predicate(a))(fa);
|
|
@@ -1473,16 +1294,13 @@ export function forkJoin(...args) {
|
|
|
1473
1294
|
} = arrayOrObject(args);
|
|
1474
1295
|
return new Observable(s => {
|
|
1475
1296
|
const length = sources.length;
|
|
1476
|
-
|
|
1477
1297
|
if (!length) {
|
|
1478
1298
|
s.complete();
|
|
1479
1299
|
return;
|
|
1480
1300
|
}
|
|
1481
|
-
|
|
1482
1301
|
const values = new Array(length);
|
|
1483
1302
|
let remainingCompletions = length;
|
|
1484
1303
|
let remainingEmissions = length;
|
|
1485
|
-
|
|
1486
1304
|
for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) {
|
|
1487
1305
|
let hasValue = false;
|
|
1488
1306
|
from_1(sources[sourceIndex]).subscribe(tsplus_module_8.operatorSubscriber(s, {
|
|
@@ -1491,7 +1309,6 @@ export function forkJoin(...args) {
|
|
|
1491
1309
|
hasValue = true;
|
|
1492
1310
|
remainingEmissions--;
|
|
1493
1311
|
}
|
|
1494
|
-
|
|
1495
1312
|
values[sourceIndex] = value;
|
|
1496
1313
|
},
|
|
1497
1314
|
complete: () => {
|
|
@@ -1502,7 +1319,6 @@ export function forkJoin(...args) {
|
|
|
1502
1319
|
return b;
|
|
1503
1320
|
}, {}) : values);
|
|
1504
1321
|
}
|
|
1505
|
-
|
|
1506
1322
|
s.complete();
|
|
1507
1323
|
}
|
|
1508
1324
|
}
|
|
@@ -1513,7 +1329,6 @@ export function forkJoin(...args) {
|
|
|
1513
1329
|
/**
|
|
1514
1330
|
* @tsplus getter fncts.observable.Observable ignore
|
|
1515
1331
|
*/
|
|
1516
|
-
|
|
1517
1332
|
export function ignore(fa) {
|
|
1518
1333
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1519
1334
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
@@ -1524,7 +1339,6 @@ export function ignore(fa) {
|
|
|
1524
1339
|
/**
|
|
1525
1340
|
* @tsplus getter fncts.observable.Observable isEmpty
|
|
1526
1341
|
*/
|
|
1527
|
-
|
|
1528
1342
|
export function isEmpty(fa) {
|
|
1529
1343
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1530
1344
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
@@ -1542,7 +1356,6 @@ export function isEmpty(fa) {
|
|
|
1542
1356
|
/**
|
|
1543
1357
|
* @tsplus getter fncts.observable.Observable materialize
|
|
1544
1358
|
*/
|
|
1545
|
-
|
|
1546
1359
|
export function materialize(fa) {
|
|
1547
1360
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1548
1361
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
@@ -1561,7 +1374,6 @@ export function materialize(fa) {
|
|
|
1561
1374
|
/**
|
|
1562
1375
|
* @tsplus pipeable fncts.observable.Observable mergeAll
|
|
1563
1376
|
*/
|
|
1564
|
-
|
|
1565
1377
|
function mergeAll_1(concurrent = Infinity) {
|
|
1566
1378
|
return self => {
|
|
1567
1379
|
return mergeMap_1(tsplus_module_13.identity, concurrent)(self);
|
|
@@ -1570,8 +1382,6 @@ function mergeAll_1(concurrent = Infinity) {
|
|
|
1570
1382
|
/**
|
|
1571
1383
|
* @tsplus pipeable fncts.observable.Observable mergeScanWithIndex
|
|
1572
1384
|
*/
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
1385
|
function mergeScanWithIndex_1(initial, f, concurrent = Infinity) {
|
|
1576
1386
|
return fa => {
|
|
1577
1387
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1585,8 +1395,6 @@ function mergeScanWithIndex_1(initial, f, concurrent = Infinity) {
|
|
|
1585
1395
|
/**
|
|
1586
1396
|
* @tsplus pipeable fncts.observable.Observable mergeScan
|
|
1587
1397
|
*/
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
1398
|
export function mergeScan(initial, f, concurrent = Infinity) {
|
|
1591
1399
|
return fa => {
|
|
1592
1400
|
return mergeScanWithIndex_1(initial, (_, b, a) => f(b, a), concurrent)(fa);
|
|
@@ -1595,19 +1403,16 @@ export function mergeScan(initial, f, concurrent = Infinity) {
|
|
|
1595
1403
|
export function onErrorResumeNext(fa, ...sources) {
|
|
1596
1404
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1597
1405
|
const remaining = [source, ...sources];
|
|
1598
|
-
|
|
1599
1406
|
const subscribeNext = () => {
|
|
1600
1407
|
if (!subscriber.closed) {
|
|
1601
1408
|
if (remaining.length > 0) {
|
|
1602
1409
|
let nextSource;
|
|
1603
|
-
|
|
1604
1410
|
try {
|
|
1605
1411
|
nextSource = from_1(remaining.shift());
|
|
1606
1412
|
} catch (err) {
|
|
1607
1413
|
subscribeNext();
|
|
1608
1414
|
return;
|
|
1609
1415
|
}
|
|
1610
|
-
|
|
1611
1416
|
const innerSub = tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1612
1417
|
error: tsplus_module_2.noop,
|
|
1613
1418
|
complete: tsplus_module_2.noop
|
|
@@ -1619,14 +1424,12 @@ export function onErrorResumeNext(fa, ...sources) {
|
|
|
1619
1424
|
}
|
|
1620
1425
|
}
|
|
1621
1426
|
};
|
|
1622
|
-
|
|
1623
1427
|
subscribeNext();
|
|
1624
1428
|
})(fa);
|
|
1625
1429
|
}
|
|
1626
1430
|
/**
|
|
1627
1431
|
* @tsplus pipeable fncts.observable.Observable onEmpty
|
|
1628
1432
|
*/
|
|
1629
|
-
|
|
1630
1433
|
function onEmpty_1(f) {
|
|
1631
1434
|
return fa => {
|
|
1632
1435
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1640,7 +1443,6 @@ function onEmpty_1(f) {
|
|
|
1640
1443
|
if (!hasValue) {
|
|
1641
1444
|
subscriber.next(f());
|
|
1642
1445
|
}
|
|
1643
|
-
|
|
1644
1446
|
subscriber.complete();
|
|
1645
1447
|
}
|
|
1646
1448
|
}));
|
|
@@ -1650,14 +1452,11 @@ function onEmpty_1(f) {
|
|
|
1650
1452
|
/**
|
|
1651
1453
|
* @tsplus pipeable fncts.observable.Observable repeat
|
|
1652
1454
|
*/
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
1455
|
export function repeat(count = Infinity) {
|
|
1656
1456
|
return fa => {
|
|
1657
1457
|
return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1658
1458
|
let repeats = 0;
|
|
1659
1459
|
let innerSub;
|
|
1660
|
-
|
|
1661
1460
|
const loop = () => {
|
|
1662
1461
|
let syncUnsub = false;
|
|
1663
1462
|
innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
@@ -1675,14 +1474,12 @@ export function repeat(count = Infinity) {
|
|
|
1675
1474
|
}
|
|
1676
1475
|
}
|
|
1677
1476
|
}));
|
|
1678
|
-
|
|
1679
1477
|
if (syncUnsub) {
|
|
1680
1478
|
innerSub.unsubscribe();
|
|
1681
1479
|
innerSub = null;
|
|
1682
1480
|
loop();
|
|
1683
1481
|
}
|
|
1684
1482
|
};
|
|
1685
|
-
|
|
1686
1483
|
loop();
|
|
1687
1484
|
})(fa);
|
|
1688
1485
|
};
|
|
@@ -1690,7 +1487,6 @@ export function repeat(count = Infinity) {
|
|
|
1690
1487
|
export function retry(configOrCount = Infinity) {
|
|
1691
1488
|
return fa => {
|
|
1692
1489
|
let config;
|
|
1693
|
-
|
|
1694
1490
|
if (configOrCount && typeof configOrCount === "object") {
|
|
1695
1491
|
config = configOrCount;
|
|
1696
1492
|
} else {
|
|
@@ -1698,7 +1494,6 @@ export function retry(configOrCount = Infinity) {
|
|
|
1698
1494
|
count: configOrCount
|
|
1699
1495
|
};
|
|
1700
1496
|
}
|
|
1701
|
-
|
|
1702
1497
|
const {
|
|
1703
1498
|
count,
|
|
1704
1499
|
resetOnSuccess = false
|
|
@@ -1706,7 +1501,6 @@ export function retry(configOrCount = Infinity) {
|
|
|
1706
1501
|
return count <= 0 ? fa : tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1707
1502
|
let retries = 0;
|
|
1708
1503
|
let innerSub;
|
|
1709
|
-
|
|
1710
1504
|
const loop = () => {
|
|
1711
1505
|
let syncUnsub = false;
|
|
1712
1506
|
innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
@@ -1714,7 +1508,6 @@ export function retry(configOrCount = Infinity) {
|
|
|
1714
1508
|
if (resetOnSuccess) {
|
|
1715
1509
|
retries = 0;
|
|
1716
1510
|
}
|
|
1717
|
-
|
|
1718
1511
|
subscriber.next(value);
|
|
1719
1512
|
},
|
|
1720
1513
|
error: err => {
|
|
@@ -1731,14 +1524,12 @@ export function retry(configOrCount = Infinity) {
|
|
|
1731
1524
|
}
|
|
1732
1525
|
}
|
|
1733
1526
|
}));
|
|
1734
|
-
|
|
1735
1527
|
if (syncUnsub) {
|
|
1736
1528
|
innerSub.unsubscribe();
|
|
1737
1529
|
innerSub = null;
|
|
1738
1530
|
loop();
|
|
1739
1531
|
}
|
|
1740
1532
|
};
|
|
1741
|
-
|
|
1742
1533
|
loop();
|
|
1743
1534
|
})(fa);
|
|
1744
1535
|
};
|
|
@@ -1746,7 +1537,6 @@ export function retry(configOrCount = Infinity) {
|
|
|
1746
1537
|
/**
|
|
1747
1538
|
* @tsplus pipeable fncts.observable.Observable sample
|
|
1748
1539
|
*/
|
|
1749
|
-
|
|
1750
1540
|
function sample_1(notifier) {
|
|
1751
1541
|
return fa => {
|
|
1752
1542
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1758,7 +1548,6 @@ function sample_1(notifier) {
|
|
|
1758
1548
|
lastValue = value;
|
|
1759
1549
|
}
|
|
1760
1550
|
}));
|
|
1761
|
-
|
|
1762
1551
|
const emit = () => {
|
|
1763
1552
|
if (hasValue) {
|
|
1764
1553
|
hasValue = false;
|
|
@@ -1767,7 +1556,6 @@ function sample_1(notifier) {
|
|
|
1767
1556
|
subscriber.next(value);
|
|
1768
1557
|
}
|
|
1769
1558
|
};
|
|
1770
|
-
|
|
1771
1559
|
notifier.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1772
1560
|
next: emit,
|
|
1773
1561
|
complete: tsplus_module_2.noop
|
|
@@ -1778,8 +1566,6 @@ function sample_1(notifier) {
|
|
|
1778
1566
|
/**
|
|
1779
1567
|
* @tsplus pipeable fncts.observable.Observable sampleTime
|
|
1780
1568
|
*/
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
1569
|
export function sampleTime(period, scheduler = tsplus_module_5.asyncScheduler) {
|
|
1784
1570
|
return fa => {
|
|
1785
1571
|
return sample_1(interval_1(period, scheduler))(fa);
|
|
@@ -1788,7 +1574,6 @@ export function sampleTime(period, scheduler = tsplus_module_5.asyncScheduler) {
|
|
|
1788
1574
|
/**
|
|
1789
1575
|
* @tsplus pipeable fncts.observable.Observable scanLeftWithIndex
|
|
1790
1576
|
*/
|
|
1791
|
-
|
|
1792
1577
|
function scanLeftWithIndex_1(initial, f) {
|
|
1793
1578
|
return fa => {
|
|
1794
1579
|
return tsplus_module_8.operate_(scanInternal(f, initial, true, true))(fa);
|
|
@@ -1797,8 +1582,6 @@ function scanLeftWithIndex_1(initial, f) {
|
|
|
1797
1582
|
/**
|
|
1798
1583
|
* @tsplus pipeable fncts.observable.Observable scanLeft
|
|
1799
1584
|
*/
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
1585
|
export function scanLeft(initial, f) {
|
|
1803
1586
|
return fa => {
|
|
1804
1587
|
return scanLeftWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
|
|
@@ -1807,35 +1590,24 @@ export function scanLeft(initial, f) {
|
|
|
1807
1590
|
/**
|
|
1808
1591
|
* @tsplus static fncts.observable.ObservableOps service
|
|
1809
1592
|
*/
|
|
1810
|
-
|
|
1811
|
-
export function service(
|
|
1812
|
-
/** @tsplus auto */
|
|
1813
|
-
tag) {
|
|
1593
|
+
export function service( /** @tsplus auto */tag) {
|
|
1814
1594
|
return serviceWithObservable_1(service => of_1(service), tag);
|
|
1815
1595
|
}
|
|
1816
1596
|
/**
|
|
1817
1597
|
* @tsplus static fncts.observable.ObservableOps serviceWith
|
|
1818
1598
|
*/
|
|
1819
|
-
|
|
1820
|
-
export function serviceWith(f,
|
|
1821
|
-
/** @tsplus auto */
|
|
1822
|
-
tag) {
|
|
1599
|
+
export function serviceWith(f, /** @tsplus auto */tag) {
|
|
1823
1600
|
return serviceWithObservable_1(service => of_1(f(service)), tag);
|
|
1824
1601
|
}
|
|
1825
1602
|
/**
|
|
1826
1603
|
* @tsplus static fncts.observable.ObservableOps serviceWithObservable
|
|
1827
1604
|
*/
|
|
1828
|
-
|
|
1829
|
-
function serviceWithObservable_1(f,
|
|
1830
|
-
/** @tsplus auto */
|
|
1831
|
-
tag) {
|
|
1605
|
+
function serviceWithObservable_1(f, /** @tsplus auto */tag) {
|
|
1832
1606
|
return environmentWithObservable_1(environment => f(tsplus_module_16.unsafeGet(tag)(environment)));
|
|
1833
1607
|
}
|
|
1834
1608
|
/**
|
|
1835
1609
|
* @tsplus pipeable fncts.observable.Observable skip
|
|
1836
1610
|
*/
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
1611
|
export function skip(count) {
|
|
1840
1612
|
return fa => {
|
|
1841
1613
|
return filterWithIndex_1((index, _) => count <= index)(fa);
|
|
@@ -1844,7 +1616,6 @@ export function skip(count) {
|
|
|
1844
1616
|
/**
|
|
1845
1617
|
* @tsplus pipeable fncts.observable.Observable skipLast
|
|
1846
1618
|
*/
|
|
1847
|
-
|
|
1848
1619
|
export function skipLast(skipCount) {
|
|
1849
1620
|
return fa => {
|
|
1850
1621
|
return skipCount <= 0 ? fa : tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1853,7 +1624,6 @@ export function skipLast(skipCount) {
|
|
|
1853
1624
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1854
1625
|
next: value => {
|
|
1855
1626
|
const valueIndex = seen++;
|
|
1856
|
-
|
|
1857
1627
|
if (valueIndex < skipCount) {
|
|
1858
1628
|
ring[valueIndex] = value;
|
|
1859
1629
|
} else {
|
|
@@ -1873,7 +1643,6 @@ export function skipLast(skipCount) {
|
|
|
1873
1643
|
/**
|
|
1874
1644
|
* @tsplus pipeable fncts.observable.Observable skipUntil
|
|
1875
1645
|
*/
|
|
1876
|
-
|
|
1877
1646
|
export function skipUntil(notifier) {
|
|
1878
1647
|
return fa => {
|
|
1879
1648
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1895,7 +1664,6 @@ export function skipUntil(notifier) {
|
|
|
1895
1664
|
/**
|
|
1896
1665
|
* @tsplus pipeable fncts.observable.Observable skipWhile
|
|
1897
1666
|
*/
|
|
1898
|
-
|
|
1899
1667
|
export function skipWhile(predicate) {
|
|
1900
1668
|
return fa => {
|
|
1901
1669
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1910,7 +1678,6 @@ export function skipWhile(predicate) {
|
|
|
1910
1678
|
/**
|
|
1911
1679
|
* @tsplus pipeable fncts.observable.Observable startWith
|
|
1912
1680
|
*/
|
|
1913
|
-
|
|
1914
1681
|
export function startWith(...values) {
|
|
1915
1682
|
return fa => {
|
|
1916
1683
|
return tsplus_module_8.operate_((source, subscriber) => {
|
|
@@ -1922,7 +1689,6 @@ export function startWith(...values) {
|
|
|
1922
1689
|
/**
|
|
1923
1690
|
* @tsplus pipeable fncts.observable.Observable subscribeOn
|
|
1924
1691
|
*/
|
|
1925
|
-
|
|
1926
1692
|
export function subscribeOn(scheduler, delay = 0) {
|
|
1927
1693
|
return fa => {
|
|
1928
1694
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1933,23 +1699,19 @@ export function subscribeOn(scheduler, delay = 0) {
|
|
|
1933
1699
|
/**
|
|
1934
1700
|
* @tsplus getter fncts.observable.Observable switchAll
|
|
1935
1701
|
*/
|
|
1936
|
-
|
|
1937
1702
|
export function switchAll(ffa) {
|
|
1938
1703
|
return switchMap_1(tsplus_module_13.identity)(ffa);
|
|
1939
1704
|
}
|
|
1940
1705
|
/**
|
|
1941
1706
|
* @tsplus pipeable fncts.observable.Observable switchMapWithIndex
|
|
1942
1707
|
*/
|
|
1943
|
-
|
|
1944
1708
|
function switchMapWithIndex_1(f) {
|
|
1945
1709
|
return fa => {
|
|
1946
1710
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
1947
1711
|
let innerSubscriber = null;
|
|
1948
1712
|
let index = 0;
|
|
1949
1713
|
let isComplete = false;
|
|
1950
|
-
|
|
1951
1714
|
const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();
|
|
1952
|
-
|
|
1953
1715
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
1954
1716
|
next: value => {
|
|
1955
1717
|
innerSubscriber?.unsubscribe();
|
|
@@ -1972,8 +1734,6 @@ function switchMapWithIndex_1(f) {
|
|
|
1972
1734
|
/**
|
|
1973
1735
|
* @tsplus pipeable fncts.observable.Observable switchMap
|
|
1974
1736
|
*/
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
1737
|
function switchMap_1(f) {
|
|
1978
1738
|
return fa => {
|
|
1979
1739
|
return switchMapWithIndex_1((_, a) => f(a))(fa);
|
|
@@ -1982,8 +1742,6 @@ function switchMap_1(f) {
|
|
|
1982
1742
|
/**
|
|
1983
1743
|
* @tsplus pipeable fncts.observable.Observable switchScanWithIndex
|
|
1984
1744
|
*/
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
1745
|
function switchScanWithIndex_1(initial, f) {
|
|
1988
1746
|
return fa => {
|
|
1989
1747
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -1998,8 +1756,6 @@ function switchScanWithIndex_1(initial, f) {
|
|
|
1998
1756
|
/**
|
|
1999
1757
|
* @tsplus pipeable fncts.observable.Observable switchScan
|
|
2000
1758
|
*/
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
1759
|
export function switchScan(initial, f) {
|
|
2004
1760
|
return fa => {
|
|
2005
1761
|
return switchScanWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
|
|
@@ -2008,7 +1764,6 @@ export function switchScan(initial, f) {
|
|
|
2008
1764
|
/**
|
|
2009
1765
|
* @tsplus pipeable fncts.observable.Observable take
|
|
2010
1766
|
*/
|
|
2011
|
-
|
|
2012
1767
|
function take_1(count) {
|
|
2013
1768
|
return fa => {
|
|
2014
1769
|
return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, sub, environment) => {
|
|
@@ -2017,7 +1772,6 @@ function take_1(count) {
|
|
|
2017
1772
|
next: value => {
|
|
2018
1773
|
if (++seen <= count) {
|
|
2019
1774
|
sub.next(value);
|
|
2020
|
-
|
|
2021
1775
|
if (count <= seen) {
|
|
2022
1776
|
sub.complete();
|
|
2023
1777
|
}
|
|
@@ -2030,8 +1784,6 @@ function take_1(count) {
|
|
|
2030
1784
|
/**
|
|
2031
1785
|
* @tsplus pipeable fncts.observable.Observable takeLast
|
|
2032
1786
|
*/
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
1787
|
export function takeLast(count) {
|
|
2036
1788
|
return fa => {
|
|
2037
1789
|
return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -2045,7 +1797,6 @@ export function takeLast(count) {
|
|
|
2045
1797
|
for (const value of buffer) {
|
|
2046
1798
|
subscriber.next(value);
|
|
2047
1799
|
}
|
|
2048
|
-
|
|
2049
1800
|
subscriber.complete();
|
|
2050
1801
|
}
|
|
2051
1802
|
}, () => {
|
|
@@ -2057,7 +1808,6 @@ export function takeLast(count) {
|
|
|
2057
1808
|
/**
|
|
2058
1809
|
* @tsplus pipeable fncts.observable.Observable takeUntil
|
|
2059
1810
|
*/
|
|
2060
|
-
|
|
2061
1811
|
export function takeUntil(notifier) {
|
|
2062
1812
|
return fa => {
|
|
2063
1813
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -2069,7 +1819,6 @@ export function takeUntil(notifier) {
|
|
|
2069
1819
|
})(fa);
|
|
2070
1820
|
};
|
|
2071
1821
|
}
|
|
2072
|
-
|
|
2073
1822
|
function takeWhileWithIndex_1(predicate, inclusive) {
|
|
2074
1823
|
return fa => {
|
|
2075
1824
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -2084,7 +1833,6 @@ function takeWhileWithIndex_1(predicate, inclusive) {
|
|
|
2084
1833
|
})(fa);
|
|
2085
1834
|
};
|
|
2086
1835
|
}
|
|
2087
|
-
|
|
2088
1836
|
export function takeWhile(predicate, inclusive) {
|
|
2089
1837
|
return fa => {
|
|
2090
1838
|
return takeWhileWithIndex_1((_, a) => predicate(a), inclusive)(fa);
|
|
@@ -2093,7 +1841,6 @@ export function takeWhile(predicate, inclusive) {
|
|
|
2093
1841
|
/**
|
|
2094
1842
|
* @tsplus pipeable fncts.observable.Observable tap
|
|
2095
1843
|
*/
|
|
2096
|
-
|
|
2097
1844
|
export function tap(observer) {
|
|
2098
1845
|
return fa => {
|
|
2099
1846
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
@@ -2121,7 +1868,6 @@ export const defaultThrottleConfig = {
|
|
|
2121
1868
|
/**
|
|
2122
1869
|
* @tsplus pipeable fncts.observable.Observable throttle
|
|
2123
1870
|
*/
|
|
2124
|
-
|
|
2125
1871
|
function throttle_1(durationSelector, {
|
|
2126
1872
|
leading,
|
|
2127
1873
|
trailing
|
|
@@ -2131,27 +1877,22 @@ function throttle_1(durationSelector, {
|
|
|
2131
1877
|
let sendValue = tsplus_module_17.nothing();
|
|
2132
1878
|
let throttled = null;
|
|
2133
1879
|
let isComplete = false;
|
|
2134
|
-
|
|
2135
1880
|
const endThrottling = () => {
|
|
2136
1881
|
throttled?.unsubscribe();
|
|
2137
1882
|
throttled = null;
|
|
2138
|
-
|
|
2139
1883
|
if (trailing) {
|
|
2140
1884
|
send();
|
|
2141
1885
|
isComplete && subscriber.complete();
|
|
2142
1886
|
}
|
|
2143
1887
|
};
|
|
2144
|
-
|
|
2145
1888
|
const cleanupThrottling = () => {
|
|
2146
1889
|
throttled = null;
|
|
2147
1890
|
isComplete && subscriber.complete();
|
|
2148
1891
|
};
|
|
2149
|
-
|
|
2150
1892
|
const startThrottling = value => throttled = from_1(durationSelector(value)).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2151
1893
|
next: endThrottling,
|
|
2152
1894
|
complete: cleanupThrottling
|
|
2153
1895
|
}));
|
|
2154
|
-
|
|
2155
1896
|
const send = () => {
|
|
2156
1897
|
if (tsplus_module_18.isJust(sendValue)) {
|
|
2157
1898
|
const {
|
|
@@ -2162,7 +1903,6 @@ function throttle_1(durationSelector, {
|
|
|
2162
1903
|
!isComplete && startThrottling(value);
|
|
2163
1904
|
}
|
|
2164
1905
|
};
|
|
2165
|
-
|
|
2166
1906
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2167
1907
|
next: value => {
|
|
2168
1908
|
sendValue = tsplus_module_17.just(value);
|
|
@@ -2179,8 +1919,6 @@ function throttle_1(durationSelector, {
|
|
|
2179
1919
|
/**
|
|
2180
1920
|
* @tsplus pipeable fncts.observable.Observable throttleTime
|
|
2181
1921
|
*/
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
1922
|
export function throttleTime(duration, scheduler = tsplus_module_5.asyncScheduler, config = defaultThrottleConfig) {
|
|
2185
1923
|
return fa => {
|
|
2186
1924
|
const duration$ = timer_1(duration, scheduler);
|
|
@@ -2193,7 +1931,6 @@ export class TimeoutError extends Error {
|
|
|
2193
1931
|
this.info = info;
|
|
2194
1932
|
this.name = "TimeoutError";
|
|
2195
1933
|
}
|
|
2196
|
-
|
|
2197
1934
|
}
|
|
2198
1935
|
export function timeout(config) {
|
|
2199
1936
|
return fa => {
|
|
@@ -2210,7 +1947,6 @@ export function timeout(config) {
|
|
|
2210
1947
|
let timerSubscription;
|
|
2211
1948
|
let lastValue = tsplus_module_17.nothing();
|
|
2212
1949
|
let seen = 0;
|
|
2213
|
-
|
|
2214
1950
|
const startTimer = delay => {
|
|
2215
1951
|
timerSubscription = caughtSchedule(subscriber, scheduler, () => {
|
|
2216
1952
|
originalSourceSubscription.unsubscribe();
|
|
@@ -2221,7 +1957,6 @@ export function timeout(config) {
|
|
|
2221
1957
|
})).provideEnvironment(environment).subscribe(subscriber);
|
|
2222
1958
|
}, delay);
|
|
2223
1959
|
};
|
|
2224
|
-
|
|
2225
1960
|
originalSourceSubscription = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2226
1961
|
next: value => {
|
|
2227
1962
|
timerSubscription?.unsubscribe();
|
|
@@ -2234,26 +1969,21 @@ export function timeout(config) {
|
|
|
2234
1969
|
if (!timerSubscription?.closed) {
|
|
2235
1970
|
timerSubscription?.unsubscribe();
|
|
2236
1971
|
}
|
|
2237
|
-
|
|
2238
1972
|
lastValue = tsplus_module_17.nothing();
|
|
2239
1973
|
}));
|
|
2240
1974
|
startTimer(first != null ? typeof first === "number" ? first : +first - scheduler.now() : each);
|
|
2241
1975
|
})(fa);
|
|
2242
1976
|
};
|
|
2243
1977
|
}
|
|
2244
|
-
|
|
2245
1978
|
function timeoutError(info) {
|
|
2246
1979
|
return fail_1(new TimeoutError(info));
|
|
2247
1980
|
}
|
|
2248
|
-
|
|
2249
1981
|
function toArrayAccumulator(arr, value) {
|
|
2250
1982
|
return arr.push(value), arr;
|
|
2251
1983
|
}
|
|
2252
1984
|
/**
|
|
2253
1985
|
* @tsplus getter fncts.observable.Observable toArray
|
|
2254
1986
|
*/
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
1987
|
function toArray_1(fa) {
|
|
2258
1988
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
2259
1989
|
foldLeft_1([], toArrayAccumulator)(source).provideEnvironment(environment).subscribe(subscriber);
|
|
@@ -2262,16 +1992,13 @@ function toArray_1(fa) {
|
|
|
2262
1992
|
/**
|
|
2263
1993
|
* @tsplus pipeable fncts.observable.Observable unique
|
|
2264
1994
|
*/
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
1995
|
export function unique(toKey, flushes) {
|
|
2268
1996
|
return fa => {
|
|
2269
1997
|
return tsplus_module_8.operate_((source, subscriber, environment) => {
|
|
2270
|
-
let distinctKeys = tsplus_module_21.
|
|
1998
|
+
let distinctKeys = tsplus_module_21.empty();
|
|
2271
1999
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2272
2000
|
next: value => {
|
|
2273
2001
|
const key = toKey ? toKey(value) : value;
|
|
2274
|
-
|
|
2275
2002
|
if (!tsplus_module_21.has(key)(distinctKeys)) {
|
|
2276
2003
|
tsplus_module_21.add(key)(distinctKeys);
|
|
2277
2004
|
subscriber.next(value);
|
|
@@ -2279,13 +2006,12 @@ export function unique(toKey, flushes) {
|
|
|
2279
2006
|
}
|
|
2280
2007
|
}));
|
|
2281
2008
|
flushes?.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2282
|
-
next: () => distinctKeys = tsplus_module_21.
|
|
2009
|
+
next: () => distinctKeys = tsplus_module_21.empty(),
|
|
2283
2010
|
complete: tsplus_module_2.noop
|
|
2284
2011
|
}));
|
|
2285
2012
|
})(fa);
|
|
2286
2013
|
};
|
|
2287
2014
|
}
|
|
2288
|
-
|
|
2289
2015
|
function uniqueUntilChanged_1(E, keySelector = tsplus_module_13.identity) {
|
|
2290
2016
|
return fa => {
|
|
2291
2017
|
const compare = "equals" in E ? E.equals : E;
|
|
@@ -2295,7 +2021,6 @@ function uniqueUntilChanged_1(E, keySelector = tsplus_module_13.identity) {
|
|
|
2295
2021
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2296
2022
|
next: value => {
|
|
2297
2023
|
const currentKey = keySelector(value);
|
|
2298
|
-
|
|
2299
2024
|
if (first || !compare(previousKey, currentKey)) {
|
|
2300
2025
|
first = false;
|
|
2301
2026
|
previousKey = currentKey;
|
|
@@ -2306,14 +2031,13 @@ function uniqueUntilChanged_1(E, keySelector = tsplus_module_13.identity) {
|
|
|
2306
2031
|
})(fa);
|
|
2307
2032
|
};
|
|
2308
2033
|
}
|
|
2309
|
-
|
|
2310
2034
|
export function uniqueUntilKeyChanged(key, equals) {
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2035
|
+
if ("equals" in equals) {
|
|
2036
|
+
return fa => uniqueUntilChanged_1((x, y) => equals.equals(y[key])(x[key]))(fa);
|
|
2037
|
+
} else {
|
|
2038
|
+
return fa => uniqueUntilChanged_1((x, y) => equals(x[key], y[key]))(fa);
|
|
2039
|
+
}
|
|
2315
2040
|
}
|
|
2316
|
-
|
|
2317
2041
|
function combineLatestInternal(subscriber, environment, observables, scheduler, valueTransform = tsplus_module_13.identity) {
|
|
2318
2042
|
return maybeSchedule(subscriber, scheduler, () => {
|
|
2319
2043
|
const {
|
|
@@ -2322,7 +2046,6 @@ function combineLatestInternal(subscriber, environment, observables, scheduler,
|
|
|
2322
2046
|
const values = new Array(length);
|
|
2323
2047
|
let active = length;
|
|
2324
2048
|
let remainingFirstValues = length;
|
|
2325
|
-
|
|
2326
2049
|
for (let i = 0; i < length; i++) {
|
|
2327
2050
|
maybeSchedule(subscriber, scheduler, () => {
|
|
2328
2051
|
const source = scheduler ? scheduled_1(scheduler)(observables[i]) : from_1(observables[i]);
|
|
@@ -2330,12 +2053,10 @@ function combineLatestInternal(subscriber, environment, observables, scheduler,
|
|
|
2330
2053
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2331
2054
|
next: value => {
|
|
2332
2055
|
values[i] = value;
|
|
2333
|
-
|
|
2334
2056
|
if (!hasFirstValue) {
|
|
2335
2057
|
hasFirstValue = true;
|
|
2336
2058
|
remainingFirstValues--;
|
|
2337
2059
|
}
|
|
2338
|
-
|
|
2339
2060
|
if (!remainingFirstValues) {
|
|
2340
2061
|
subscriber.next(valueTransform(values.slice()));
|
|
2341
2062
|
}
|
|
@@ -2350,7 +2071,6 @@ function combineLatestInternal(subscriber, environment, observables, scheduler,
|
|
|
2350
2071
|
}
|
|
2351
2072
|
});
|
|
2352
2073
|
}
|
|
2353
|
-
|
|
2354
2074
|
function findInternal(predicate, emit) {
|
|
2355
2075
|
const findIndex = emit === "index";
|
|
2356
2076
|
return (source, subscriber, environment) => {
|
|
@@ -2358,7 +2078,6 @@ function findInternal(predicate, emit) {
|
|
|
2358
2078
|
source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
|
|
2359
2079
|
next: value => {
|
|
2360
2080
|
const i = index++;
|
|
2361
|
-
|
|
2362
2081
|
if (predicate(index++, value)) {
|
|
2363
2082
|
subscriber.next(findIndex ? i : tsplus_module_17.just(value));
|
|
2364
2083
|
subscriber.complete();
|
|
@@ -2371,11 +2090,9 @@ function findInternal(predicate, emit) {
|
|
|
2371
2090
|
}));
|
|
2372
2091
|
};
|
|
2373
2092
|
}
|
|
2374
|
-
|
|
2375
2093
|
export function joinAllInternal(fa, joiner) {
|
|
2376
2094
|
return mergeMap_1(joiner)(toArray_1(fa));
|
|
2377
2095
|
}
|
|
2378
|
-
|
|
2379
2096
|
function maybeSchedule(subscription, scheduler, execute) {
|
|
2380
2097
|
if (scheduler) {
|
|
2381
2098
|
subscription.add(scheduler.schedule(execute));
|
|
@@ -2383,21 +2100,17 @@ function maybeSchedule(subscription, scheduler, execute) {
|
|
|
2383
2100
|
execute();
|
|
2384
2101
|
}
|
|
2385
2102
|
}
|
|
2386
|
-
|
|
2387
2103
|
function mergeInternal(source, subscriber, environment, f, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
|
|
2388
2104
|
const buffer = [];
|
|
2389
2105
|
let active = 0;
|
|
2390
2106
|
let index = 0;
|
|
2391
2107
|
let isComplete = false;
|
|
2392
|
-
|
|
2393
2108
|
const checkComplete = () => {
|
|
2394
2109
|
if (isComplete && !buffer.length && !active) {
|
|
2395
2110
|
subscriber.complete();
|
|
2396
2111
|
}
|
|
2397
2112
|
};
|
|
2398
|
-
|
|
2399
2113
|
const outerNext = a => active < concurrent ? doInnerSub(a) : buffer.push(a);
|
|
2400
|
-
|
|
2401
2114
|
const doInnerSub = a => {
|
|
2402
2115
|
expand && subscriber.next(a);
|
|
2403
2116
|
active++;
|
|
@@ -2405,7 +2118,6 @@ function mergeInternal(source, subscriber, environment, f, concurrent, onBeforeN
|
|
|
2405
2118
|
from_1(f(index++, a)).provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
2406
2119
|
next: b => {
|
|
2407
2120
|
onBeforeNext?.(b);
|
|
2408
|
-
|
|
2409
2121
|
if (expand) {
|
|
2410
2122
|
outerNext(b);
|
|
2411
2123
|
} else {
|
|
@@ -2419,12 +2131,10 @@ function mergeInternal(source, subscriber, environment, f, concurrent, onBeforeN
|
|
|
2419
2131
|
if (innerComplete) {
|
|
2420
2132
|
try {
|
|
2421
2133
|
active--;
|
|
2422
|
-
|
|
2423
2134
|
while (buffer.length && active < concurrent) {
|
|
2424
2135
|
const bufferedValue = buffer.shift();
|
|
2425
2136
|
innerSubScheduler ? subscriber.add(innerSubScheduler.schedule(() => doInnerSub(bufferedValue))) : doInnerSub(bufferedValue);
|
|
2426
2137
|
}
|
|
2427
|
-
|
|
2428
2138
|
checkComplete();
|
|
2429
2139
|
} catch (err) {
|
|
2430
2140
|
subscriber.error(tsplus_module_1.halt(err));
|
|
@@ -2432,7 +2142,6 @@ function mergeInternal(source, subscriber, environment, f, concurrent, onBeforeN
|
|
|
2432
2142
|
}
|
|
2433
2143
|
}));
|
|
2434
2144
|
};
|
|
2435
|
-
|
|
2436
2145
|
source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
|
|
2437
2146
|
next: outerNext,
|
|
2438
2147
|
complete: () => {
|
|
@@ -2444,7 +2153,6 @@ function mergeInternal(source, subscriber, environment, f, concurrent, onBeforeN
|
|
|
2444
2153
|
additionalTeardown?.();
|
|
2445
2154
|
};
|
|
2446
2155
|
}
|
|
2447
|
-
|
|
2448
2156
|
export function scanInternal(f, initial, hasInitial, emitOnNext, emitBeforeComplete) {
|
|
2449
2157
|
return (source, subscriber, environment) => {
|
|
2450
2158
|
let hasState = hasInitial;
|