In my program, I have a few timer(1000).subscribe()
instances as well as some timer(1000, 1000).subscribe()
parts.
I was experiencing some memory leak issues and was wondering if I could alleviate those by unsubscribing from timers. Unsubscribing from recurring timers seems straight forward and necessary, but do I also have to unsubscribe from timers that only emit once?
The second part of my question is if there is a better way to unsubscribe from the emitting timer than to put it into a variable like so:
const myTimer = timer(1000).subscribe(() => {
myTimer.unsubscribe();
});
Thanks!