onEach

open fun <S : MavericksState> MavericksViewModel<S>.onEach(deliveryMode: DeliveryMode = RedeliverOnStart, action: suspend (S) -> Unit): Job

Subscribes to all state updates for the given viewModel.

Parameters

deliveryMode

If UniqueOnly when this MavericksView goes from a stopped to started 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.

action

supports cooperative cancellation. The previous action will be cancelled if it is not completed before the next one is emitted.

open fun <S : MavericksState, A> MavericksViewModel<S>.onEach(prop1: KProperty1<S, A>, deliveryMode: DeliveryMode = RedeliverOnStart, action: suspend (A) -> Unit): Job

Subscribes to state changes for only a specific property and calls the action with only that single property.

Parameters

deliveryMode

If UniqueOnly, when this MavericksView 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.

action

supports cooperative cancellation. The previous action will be cancelled if it is not completed before the next one is emitted.

open fun <S : MavericksState, A, B> MavericksViewModel<S>.onEach(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, deliveryMode: DeliveryMode = RedeliverOnStart, action: suspend (A, B) -> Unit): Job

Subscribes to state changes for two properties.

Parameters

deliveryMode

If UniqueOnly, when this MavericksView 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

action

supports cooperative cancellation. The previous action will be cancelled if it is not completed before the next one is emitted..

open fun <S : MavericksState, A, B, C> MavericksViewModel<S>.onEach(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, prop3: KProperty1<S, C>, deliveryMode: DeliveryMode = RedeliverOnStart, action: suspend (A, B, C) -> Unit): Job

Subscribes to state changes for three properties.

Parameters

deliveryMode

If UniqueOnly, when this MavericksView 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.

action

supports cooperative cancellation. The previous action will be cancelled if it is not completed before the next one is emitted.

open fun <S : MavericksState, A, B, C, D> MavericksViewModel<S>.onEach(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, prop3: KProperty1<S, C>, prop4: KProperty1<S, D>, deliveryMode: DeliveryMode = RedeliverOnStart, action: suspend (A, B, C, D) -> Unit): Job

Subscribes to state changes for four properties.

Parameters

deliveryMode

If UniqueOnly, when this MavericksView 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.

action

supports cooperative cancellation. The previous action will be cancelled if it is not completed before the next one is emitted.

open fun <S : MavericksState, A, B, C, D, E> MavericksViewModel<S>.onEach(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, prop3: KProperty1<S, C>, prop4: KProperty1<S, D>, prop5: KProperty1<S, E>, deliveryMode: DeliveryMode = RedeliverOnStart, action: suspend (A, B, C, D, E) -> Unit): Job

Subscribes to state changes for five properties.

Parameters

deliveryMode

If UniqueOnly, when this MavericksView 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.

action

supports cooperative cancellation. The previous action will be cancelled if it is not completed before the next one is emitted.

open fun <S : MavericksState, A, B, C, D, E, F> MavericksViewModel<S>.onEach(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, prop3: KProperty1<S, C>, prop4: KProperty1<S, D>, prop5: KProperty1<S, E>, prop6: KProperty1<S, F>, deliveryMode: DeliveryMode = RedeliverOnStart, action: suspend (A, B, C, D, E, F) -> Unit): Job

Subscribes to state changes for six properties.

Parameters

deliveryMode

If UniqueOnly, when this MavericksView 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.

action

supports cooperative cancellation. The previous action will be cancelled if it is not completed before the next one is emitted.

open fun <S : MavericksState, A, B, C, D, E, F, G> MavericksViewModel<S>.onEach(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, prop3: KProperty1<S, C>, prop4: KProperty1<S, D>, prop5: KProperty1<S, E>, prop6: KProperty1<S, F>, prop7: KProperty1<S, G>, deliveryMode: DeliveryMode = RedeliverOnStart, action: suspend (A, B, C, D, E, F, G) -> Unit): Job

Subscribes to state changes for seven properties.

Parameters

deliveryMode

If UniqueOnly, when this MavericksView 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.

action

supports cooperative cancellation. The previous action will be cancelled if it is not completed before the next one is emitted.