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

commonMain.pro.respawn.flowmvi.api.IntentReceiver.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

/**
 * An entity that can receive and process [MVIIntent]s. Usually, this is a [Store].
 */
public interface IntentReceiver {

    /**
     * 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**.
     * @See MVIIntent
     */
    public fun send(intent: I)

    /**
     * Alias for [send] with one difference - this function will suspend if
     * [pro.respawn.flowmvi.dsl.StoreBuilder.onOverflow] permits it.
     */
    public suspend fun emit(intent: I)

    /**
     * Alias for [send]
     */
    public fun intent(intent: I): Unit = send(intent)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy