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

asyncSubscribe

open fun <S : MvRxState, T> BaseMvRxViewModel<S>.asyncSubscribe(asyncProp: KProperty1<S, Async<T>>, deliveryMode: DeliveryMode = RedeliverOnStart, 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.

Parameters

deliveryMode -

If UniqueOnly, when this MvRxView goes from a stopped to start lifecycle a state value will only be emitted if the state changed. This is useful for transient views that should only be shown once (toasts, poptarts), or logging. Most other views should use false, as when a view is destroyed and recreated the previous state is necessary to recreate the view.

Use uniqueOnly to automatically create a UniqueOnly mode with a unique id for this view.

Default: RedeliverOnStart.