如何从观察方面取消订阅所有观察者?

时间:2015-11-19 09:24:18

标签: reactive-programming rx-scala reactivex

使用rxscala,我们可以订阅这样的observable:

val stream = Observable.just(1, 2, 3)

stream.subscribe(x => doSomething(x))
stream.subscribe(x => doSomething(x))
stream.subscribe(x => doSomething(x))
stream.subscribe(x => doSomething(x))

是否可以取消订阅stream方面的所有观察员(有4个)?

0 个答案:

没有答案