storeDelegatePlugin

fun <S : MVIState, I : MVIIntent, A : MVIAction, CS : MVIState, CI : MVIIntent, CA : MVIAction> storeDelegatePlugin(delegate: StoreDelegate<CS, CI, CA>, name: String? = delegate.name, start: Boolean = true, blocking: Boolean = false, consume: ChildConsume<S, I, A, CA>? = null): StorePlugin<S, I, A>

Creates a new plugin that will:

  1. If start is true, launch the provided delegate in the installed store's pro.respawn.flowmvi.api.PipelineContext. See childStorePlugin for more details.

  2. Update the delegate's StoreDelegate.stateProjection with the values from the delegated store according to the DelegationMode provided to the delegate, and handle actions using the provided consume function.

Warning: The delegate's StoreDelegate.stateProjection is not guaranteed to be up-to-date. It is a projection based on DelegationMode.

Return

A store plugin that can be installed in the principal store

Parameters

delegate

The store delegate to use

name

Optional name for the plugin, by default allows only one plugin per delegate.

start

Whether to automatically start the delegate store when the plugin is installed

blocking

Whether to wait for the delegate store to start before continuing (applies if start is true)

consume

Optional function to handle actions from the delegate store