Is the operator takeUntil affected by other operators, and do you have to use it twice inside a switchMap?
For example;
Assume that I have an observable that emits a value when I no longer want to subscribe, and we'll refer to this as this._destroyed.
Does it matter if there is a delay operator before a takeUntil?
of("something").pipe(
delay(1000),
takeUntil(this._destroyed)
);
Is the above any different from reversing the order?
of("something").pipe(
takeUntil(this._destroyed),
delay(1000)
);
What if I use switchMap do I have to call takeUntil twice?
of("something").pipe(
takeUntil(this._destroyed),
delay(1000),
switchMap(() => {
return of("other").pipe(
takeUntil(this._destroyed),
delay(1000)
);
}
);
Is the above functionally the same as calling takeUntil once?
of("something").pipe(
delay(1000),
switchMap(() => {
return of("other").pipe(delay(1000));
}),
takeUntil(this._destroyed)
);
I guess I'm confused as to what happens when takeUntil is triggered and stops the current subscription. How is it impacted by when it is called in the pipe order (if there is any impact at all).