LoginSignup
3
3

More than 5 years have passed since last update.

ReactiveExtensionsで複数のsubscriptionをまとめて返す

Last updated at Posted at 2016-01-25

CompositeSubscriptionを使う。

fun subscribe(): Subscription {
    return CompositeSubscription().apply {
        this.add(hogeObservable.subscribe())
        this.add(fugaObservable.subscribe())
    }
}

追記(2016/01/25)

これで良かった。

fun subscribe(): Subscription {
    return CompositeSubscription(
        hogeObservable.subscribe(),
        fugaObservable.subscribe()
    )
}
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3