Loop
abstract class Loop<out TState : Any, TModel : Any, in TArgs, TDependency, in TAction : Action<TModel, TDependency>>(model: TModel, renderer: Renderer<TState, TModel>, args: TArgs? = null, argsApplyer: ArgsApplyer<TModel, TArgs>? = null, onStart: ActionEmitter<TModel, TDependency>.() -> Unit = {}, dependency: TDependency? = null, effectContext: CoroutineContext = Dispatchers.IO) : ActionEmitter<TModel, TDependency>
Base class that handles unidirectional data flow.
Parameters
model
the initial model
renderer
transform model into state
args
input arguments
argsApplyer
method to apply new args to the model
onStart
block to run before beginning to collect the loop actions
dependency
dependency container
effectContext
dispatcher for launching effects
Inheritors
Constructors
Link copied to clipboard
constructor(model: TModel, renderer: Renderer<TState, TModel>, args: TArgs? = null, argsApplyer: ArgsApplyer<TModel, TArgs>? = null, onStart: ActionEmitter<TModel, TDependency>.() -> Unit = {}, dependency: TDependency? = null, effectContext: CoroutineContext = Dispatchers.IO)
Properties
Link copied to clipboard
val <TState : Any, TModel : Any, TArgs : TModel, TDependency, TAction : Action<TModel, TDependency>> Loop<TState, TModel, TArgs, TDependency, TAction>.firstState: TState
The first state of this com.ekezet.hurok.Loop in a blocking fashion. Useful for testing.
Functions
Link copied to clipboard
fun <TState : Any, TModel : Any, TArgs, TDependency, TAction : Action<TModel, TDependency>, TLoopBuilder : LoopBuilder<TState, TModel, TArgs, TDependency, TAction>> Loop<TState, TModel, TArgs, TDependency, TAction>.asBuilder(): TLoopBuilder
Link copied to clipboard
Attach this loop as a child to another loop.
Link copied to clipboard
Emit an action to change the state or trigger an effect.