Store
A central business logic unit for handling MVIIntents, MVIActions, and MVIStates. Usually not subclassed but used with a corresponding builder (see pro.respawn.flowmvi.dsl.store). A store functions independently of any subscribers, has its own lifecycle, can be stopped and relaunched at will. The store can be mutated only through MVIIntent. Store is an IntentReceiver and can be closed to stop it.
Inheritors
Properties
The name of the store. Used for debugging purposes and when storing multiple stores in a collection. Optional and configured through a pro.respawn.flowmvi.dsl.StoreBuilder
Functions
Alias for intent with one difference - this function will suspend if pro.respawn.flowmvi.dsl.StoreBuilder.onOverflow permits it.
Alias for IntentReceiver.emit for multiple intents
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.
Alias for IntentReceiver.intent for multiple intents
An alias for pro.respawn.flowmvi.api.IntentReceiver.intent (LambdaIntent (block))
Alias for IntentReceiver.intent
Alias for IntentReceiver.intent for multiple intents
An alias for pro.respawn.flowmvi.api.IntentReceiver.send (LambdaIntent (block))
Starts store intent processing in a new coroutine in the given scope. Intents are processed as long as the parent scope is active. Starting store processing when it is already started will result in an exception. Although not always needed, store can be launched multiple times, assuming you cancel the job used before or call Store.close.
Subscribe to the store, obtaining a Provider to consume MVIStates and MVIActions. The store itself does not expose actions or states to prevent subscribers from affecting the store and to keep track of each subscription. When subscribe is invoked, a new StorePlugin.onSubscribe event is sent to all plugins with the new subscriber count. For more, see StorePlugin.