Hey Sumant chhunchha, I think that this class might be helpful for taking away some of the boilerplate with imperative subscriptions.
However, I prefer the approach taken by @fatsu in ngx-destroy, which seems to be inspired by this discussion.
In that module, a subscription for handling destruction is declarative and doesn’t require anyone to extend a class and end up with multiple inheritance issues. Here is an example of its usage:
I almost always prefer allowing your streams to declare how they will eventually stop emitting. In general, here’s my rule for “managing” subscriptions:
If all you are doing with a subscription is calling “unsubscribe” you probably should be using an operator instead.
But don’t let me stop your from your approach! Especially with streams, I think you should take the approach with which your team is most comfortable and productive. Thanks for your feedback!