switchMap
is mergeMap
that checks for an "inner" subscription. If the "inner" subscription exists, switchMap
unsubscribes from that "inner" subscription which effectively "cancels" any pending pushes.
Great explanation of switchMap
!
My default Webpack build process breaks when I try to declare innerSubscription
above the constructor. Seems like something is missing to handle that; not sure what or why. However, it's not necessary to declare the property. It is sufficient to reference and set this.innerSubscription
inside _next
. In fact, we're already doing that (working with an undeclared property) with this.fn
.