All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.pro.respawn.flowmvi.api.Consumer.kt Maven / Gradle / Ivy

Go to download

A Kotlin Multiplatform MVI library based on plugins that is simple, fast, powerful & flexible

There is a newer version: 3.0.0
Show newest version
package pro.respawn.flowmvi.api

/**
 * A [consume]r of [Store]'s events that has certain state [S].
 * Each [Consumer] needs a container, a way to [send] intents to it,
 * a way to [render] the new state, and a way to [consume] side-effects.
 */
public interface Consumer : IntentReceiver {

    /**
     * Container, an object that wraps a Store.
     */
    public val container: Container

    override fun send(intent: I): Unit = container.store.send(intent)
    override suspend fun emit(intent: I): Unit = container.store.emit(intent)
}