commonMain.pro.respawn.flowmvi.plugins.ConsumeIntentsPlugin.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core-jvm Show documentation
Show all versions of core-jvm Show documentation
A Kotlin Multiplatform MVI library based on plugins that is simple, fast, powerful & flexible
package pro.respawn.flowmvi.plugins
import pro.respawn.flowmvi.api.MVIAction
import pro.respawn.flowmvi.api.MVIIntent
import pro.respawn.flowmvi.api.MVIState
import pro.respawn.flowmvi.api.StorePlugin
import pro.respawn.flowmvi.dsl.StoreBuilder
private const val ConsumeIntentsPluginName: String = "ConsumeIntents"
/**
* Create a [StorePlugin] that simply consumes intents and does nothing with them.
* This is useful when you are using [reducePlugin] with `consume = false`
* You can add this to the end of your store declaration to consume the remaining unprocessed intents if you are
* **sure** that you already handled all of them fully
*
* @see reducePlugin
*/
public fun consumeIntentsPlugin(
name: String = ConsumeIntentsPluginName,
): StorePlugin = reducePlugin(name = name, consume = true) { }
/**
* Create and install a plugin that consumes intents and does nothing with them.
*
* This is useful when you are using [reducePlugin] with `consume = false`
* You can add this to the end of your store declaration to consume the remaining unprocessed intents if you are
* **sure** that you already handled all of them fully
* @see consumeIntents
* @see reduce
*/
public fun StoreBuilder.consumeIntents(
name: String = ConsumeIntentsPluginName,
): Unit = reduce(name = name, consume = true) { }
© 2015 - 2025 Weber Informatics LLC | Privacy Policy