mvrx-rxjava2 / com.airbnb.mvrx / BaseMvRxViewModel / asyncSubscribe

asyncSubscribe

protected fun <T> asyncSubscribe(asyncProp: KProperty1<S, Async<T>>, onFail: ((Throwable) -> Unit)? = null, onSuccess: ((T) -> Unit)? = null): Disposable

Subscribe to changes in an async property. There are optional parameters for onSuccess and onFail which automatically unwrap the value or error.

protected fun <T, S : MavericksState> asyncSubscribe(viewModel: BaseMvRxViewModel<S>, asyncProp: KProperty1<S, Async<T>>, onFail: ((Throwable) -> Unit)? = null, onSuccess: ((T) -> Unit)? = null): Unit

Subscribe to changes in an async property in a different ViewModel. There are optional parameters for onSuccess and onFail which automatically unwrap the value or error.