function
stable
Flattens an Observable-of-Observables by applying combineLatest
when the Observable-of-Observables completes.
combineAll<T, R>(project?: (...values: Array<any>) => R): OperatorFunction<T, R>
project | Optional. Default is Type: |
OperatorFunction<T, R>
:
combineAll
takes an Observable of Observables, and collects all Observables from it. Once the outer Observable completes, it subscribes to all collected Observables and combines their values using the combineLatest
strategy, such that:
When the returned observable emits, it emits all of the latest values by:
project
function is provided, it is called with each recent value from each inner Observable in whatever order they arrived, and the result of the project
function is what is emitted by the output Observable.project
function, an array of all the most recent values is emitted by the output Observable.combineAll
import { fromEvent, interval } from 'rxjs'; import { map, combineAll, take } from 'rxjs/operators'; const clicks = fromEvent(document, 'click'); const higherOrder = clicks.pipe( map(ev => interval(Math.random() * 2000).pipe(take(3)) ), take(2) ); const result = higherOrder.pipe( combineAll() ); result.subscribe(x => console.log(x));
combineAll(): OperatorFunction<ObservableInput<T>, T[]>
There are no parameters.
OperatorFunction<ObservableInput<T>, T[]>
combineAll(): OperatorFunction<any, T[]>
There are no parameters.
OperatorFunction<any, T[]>
combineAll(project: (...values: T[]) => R): OperatorFunction<ObservableInput<T>, R>
project | Type: |
OperatorFunction<ObservableInput<T>, R>
combineAll(project: (...values: Array<any>) => R): OperatorFunction<any, R>
project | Type: |
OperatorFunction<any, R>
© 2015–2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors.
Code licensed under an Apache-2.0 License. Documentation licensed under CC BY 4.0.
https://rxjs.dev/api/operators/combineAll