ReferenceconcatMap
Reference · 23
concatMap
concatMap
Runs inner streams sequentially, waiting for the previous one to complete.
Signature
concatMap(project): OperatorFunction
Marble diagram
outer: --a---b---|
inner(a): --1-2-3|
result: --1-2-3-----1-2-3-|
What it does
Equivalent to mergeMap(fn, 1): the next inner starts only after the previous one completes. Guarantees strict output order.
When to use
Ordered database writes, a queue of user actions, migrations, wizard steps. Whenever order matters more than speed.
Gotcha
If a previous inner never completes, the later ones never start. Infinite sources (interval without take) break the logic.
See also
mergeMap, switchMap, concat
script.ts
CONSOLE · Console output
Hit Run to see the result...