BACK
ReferenceswitchAll
Reference · 104

switchAll

switchAll

rxjs.dev

Always listens to only the newest inner Observable.

Signature

switchAll(): OperatorFunction, T>

What it does

On a new inner Observable it unsubscribes from the previous one and switches to the new one. It completes when the outer stream and the current inner are both done.

When to use

When outer already holds Observables and old work should be cancelled when new work arrives.

See also

switchMap, mergeAll, concatAll

script.ts // TypeScript
CONSOLE · Console output
Hit Run to see the result...