vector / com.haroldadmin.vector.state / StateHolder

StateHolder

interface StateHolder<S :VectorState>

Holds the current state value and provides access to it. A ConflatedBroadcastChannel is used to hold the current state value. clear should be called when this state holder is no longer in use.

Parameters

S - The state type implementing VectorState

Properties

Name Summary
isCleared open val isCleared:Boolean
A convenient way to check if this StateHolder has been cleared or not
state open val state:S
A convenient way to access the current state value in the stateObservable
stateObservable abstract val stateObservable: ConflatedBroadcastChannel<S>
A ConflatedBroadcastChannel to expose the state as an observable entity. This channel is conflated, so only the latest state value is present in it

Functions

Name Summary
clearHolder abstract fun clearHolder():Unit
This method is expected to be called when this state holder is no longer being used

Inheritors

Name Summary
StateStore abstract class StateStore<S :VectorState> :StateHolder<S>,StateProcessor<S>
A class which can hold current state as well as handle actions to be performed on it.