switchScan

function stable

Applies an accumulator function over the source Observable where the accumulator function itself returns an Observable, emitting values only from the most recently returned Observable.

switchScan<T, R, O extends ObservableInput<any>>(accumulator: (acc: R, value: T, index: number) => O, seed: R): OperatorFunction<T, ObservedValueOf<O>>

Parameters

accumulator

The accumulator function called on each source value.

seed

The initial accumulation value.

Returns

OperatorFunction<T, ObservedValueOf<O>>: A function that returns an observable of the accumulated values.

Description

It's like scan, but only the most recent Observable returned by the accumulator is merged into the outer Observable.

See Also

© 2015–2021 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/switchScan