Unlike mergeMap
and switchMap
, concatMap
focuses on when "inner" subscriptions "complete" by using a "buffer". Each time concatMap
receives a value, it adds each value to a "buffer", waits for previous "inner" subscription to complete
, then invokes next
with the next value from the "buffer".
Wow, this complex functionality is surprisingly simple to implement...thanks to a very clever design.
As I noted in my comment on the previous video, once again I wasn't able to declare a non-functional property at root on the class—this time buffer
—without Webpack's build process breaking. However, the issue was easily solved by appending this.buffer = [];
to the end of the constructor.