aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/rxjs/src/internal/operators/concatWith.ts
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/rxjs/src/internal/operators/concatWith.ts')
-rw-r--r--node_modules/rxjs/src/internal/operators/concatWith.ts48
1 files changed, 48 insertions, 0 deletions
diff --git a/node_modules/rxjs/src/internal/operators/concatWith.ts b/node_modules/rxjs/src/internal/operators/concatWith.ts
new file mode 100644
index 0000000..b836b29
--- /dev/null
+++ b/node_modules/rxjs/src/internal/operators/concatWith.ts
@@ -0,0 +1,48 @@
+import { ObservableInputTuple, OperatorFunction } from '../types';
+import { concat } from './concat';
+
+/**
+ * Emits all of the values from the source observable, then, once it completes, subscribes
+ * to each observable source provided, one at a time, emitting all of their values, and not subscribing
+ * to the next one until it completes.
+ *
+ * `concat(a$, b$, c$)` is the same as `a$.pipe(concatWith(b$, c$))`.
+ *
+ * ## Example
+ *
+ * Listen for one mouse click, then listen for all mouse moves.
+ *
+ * ```ts
+ * import { fromEvent, map, take, concatWith } from 'rxjs';
+ *
+ * const clicks$ = fromEvent(document, 'click');
+ * const moves$ = fromEvent(document, 'mousemove');
+ *
+ * clicks$.pipe(
+ * map(() => 'click'),
+ * take(1),
+ * concatWith(
+ * moves$.pipe(
+ * map(() => 'move')
+ * )
+ * )
+ * )
+ * .subscribe(x => console.log(x));
+ *
+ * // 'click'
+ * // 'move'
+ * // 'move'
+ * // 'move'
+ * // ...
+ * ```
+ *
+ * @param otherSources Other observable sources to subscribe to, in sequence, after the original source is complete.
+ * @return A function that returns an Observable that concatenates
+ * subscriptions to the source and provided Observables subscribing to the next
+ * only once the current subscription completes.
+ */
+export function concatWith<T, A extends readonly unknown[]>(
+ ...otherSources: [...ObservableInputTuple<A>]
+): OperatorFunction<T, T | A[number]> {
+ return concat(...otherSources);
+}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage