rxjssubject

What is the difference between the isStopped and closed property of the Subject class?


The class Subject has 2 properties closed and isStopped. I know that closed can be used to check whether the Subject can still be subscribed to, but what should isStopped be used for exactly?

I am asking this because I am trying to find a way to know when a next operation of a BehaviourSubject is completed. Can I use isStopped for that or is it used for something else?


Solution

  • The compared behavior of closed and isStopped can be seen in terms of resultant values after each operation:

    This is non-exhaustive just show the commons scenarios.