Is it necessary to unsubscribe from a combineLatest within a forkJoin?
According to the RXJS documentation itself, from what I understood, the forkJoin, when finishing all the calls, it gives completed(), which automatically unsubscribes, with this it is not necessary to manually unsubscribe.
But what if I have a combineLatest that is signing something, like this:
forkJoin({
xSubject: this.serviceX.on(),
ySubject: this.serviceY.on(),
zSubject: this.serviceZ.on(),
wSubject: this.serviceW.on()
})
.pipe(
switchMap(({ xSubject, ySubject, zSubject, wSubject }) => {
return combineLatest([xSubject, ySubject, zSubject, wSubject]);
})
)
.subscribe(([x, y, z, w]) => {
console.log(x)
console.log(y)
console.log(z)
console.log(w)
});
Is it necessary to unsubscribe from it? What is the best way in this case, if necessary?
0 comments:
Post a Comment
Thanks