Invoke method when no observers for RxJs Subject
问题 How to invoke a method when all the observers have unsubscribed from a subject. Update const alphaStore = new BehaviourSubject(0); observer1 = alphaStore.subscribe(console.log); observer2 = alphaStore.subscribe(console.log); And when all of these observers unsubscribe. I want a method to be invoked. Like... Observer1 unsubscribed Observer2 unsubscribed All observers left 回答1: What you describe already does the finalize() operator. Better said finalize() calls its callback when the chain