Closed mrdulin closed 7 years ago
"rx": "^4.1.0",
I follow the official doc, I want to unsubscribe two subscription, but it give me an error.
unsubscribe
subscription
subscription.add(childSubscription); ^ TypeError: subscription.add is not a function
Here is my code snippet:
const Rx = require('rx'); const obs1 = Rx.Observable.interval(1000); const obs2 = Rx.Observable.interval(1000); const subscription = obs1.subscribe(x => console.log(x)); const childSubscription = obs2.subscribe(x => console.log(x)); subscription.add(childSubscription); setTimeout(() => { subscription.dispose(); }, 2000);
I am so confused about the official doc.
See my answer to your other question. You are referencing docs for v5 and above. For v4 you need to use a CompositeDisposable to group Disposables together.
CompositeDisposable
@paulpdaniels Thanks. I am clear!
"rx": "^4.1.0",
I follow the official doc, I want to
unsubscribe
twosubscription
, but it give me an error.Here is my code snippet:
I am so confused about the official doc.