Consumer

A consumer of Store's events that has certain state S. Each Consumer needs a container, a way to emit intents to it, a way to render the new state.

Properties

Link copied to clipboard
abstract val container: Container<S, I, A>

Container, an object that wraps a Store.

Functions

Link copied to clipboard
open suspend override fun emit(intent: I)

Alias for intent with one difference - this function will suspend if pro.respawn.flowmvi.dsl.StoreBuilder.onOverflow permits it.

Link copied to clipboard
inline suspend fun <I : MVIIntent> IntentReceiver<I>.emit(vararg intents: I)

Alias for IntentReceiver.emit for multiple intents

Link copied to clipboard
open override fun intent(intent: I)

Send an intent asynchronously. The intent is sent to the receiver and is placed in a queue. When IntentReceiver is available (e.g. when the Store is started), the intent will be processed. Intents that overflow the buffer will be handled according to the behavior specified in pro.respawn.flowmvi.dsl.StoreBuilder.onOverflow. If the store is not started when an intent is sent, it will wait in the buffer, and will be processed once the store is started.

Link copied to clipboard
inline fun <I : MVIIntent> IntentReceiver<I>.intent(vararg intents: I)

Alias for IntentReceiver.intent for multiple intents

Link copied to clipboard
abstract fun render(state: S)

Render a new state. This function will be called each time a new state is received.

Link copied to clipboard
fun <I : MVIIntent> IntentReceiver<I>.send(intent: I)
inline fun <I : MVIIntent> IntentReceiver<I>.send(vararg intents: I)

Alias for IntentReceiver.intent for multiple intents

Link copied to clipboard
fun <S : MVIState, I : MVIIntent, A : MVIAction> StateConsumer<S>.subscribe(store: ImmutableStore<S, I, A>, scope: CoroutineScope): Job

Subscribe to the store and invoke StateConsumer.render in the provided scope.