What is the equivalent of "onCancel" callback of BehaviorSubject of RxDart but in RxJs? #7122
Unanswered
MiniSuperDev
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Not sure, but I don't think there's a built-in solution. But would this work? const subject = new BehaviorSubject();
const observable$ = subject.pipe(
finalize(() => console.log('onCancel')),
share()
); Everyone consuming |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://pub.dev/documentation/rxdart/latest/rx/BehaviorSubject/BehaviorSubject.html
In RxDart when you instantiated a
BehaviorSubject
, you can passonCancel
callback, that is called every time all listeners was unsubscribed.How can i have this callback in RxJs?
Beta Was this translation helpful? Give feedback.
All reactions