Package-level declarations
Utilities for using hurok with Compose Multiplatform
This package contains the LoopView which can be used to attach a Loop to a @Composable
function.
For example:
@Composable
fun ScoreScreenView() {
LoopView(ScoreScreenLoop) {
Column {
Text(text = playerName)
Text(text = score)
Button(onClick = { emit(OnUpdateScoreClick) }) {
Text(text = "Update score")
}
}
}
}
In the above example ScoreScreenLoop
is a LoopBuilder. A LoopBuilder(com.ekezet.hurok.LoopBuilder) is used to create a Loop by passing optional arguments and is needed to re-create the given Loop when the function leaves the composition (e.g. a configuration change).
class ScoreScreenLoop(
model: ScoreScreenModel,
renderer: Renderer<ScoreScreenModel, ScoreScreenDependency, ScoreScreenState>,
args: ScoreScreenArgs? = null,
firstAction: ScoreScreenAction? = null,
dependency: ScoreScreenDependency? = null,
effectContext: CoroutineContext = DispatcherProvider.IO,
) : Loop<ScoreScreenState, ScoreScreenModel, ScoreScreenArgs, ScoreScreenDependency, ScoreScreenAction>(
model,
renderer,
args,
firstAction,
dependency,
effectContext,
) {
companion object Builder :
LoopBuilder<ScoreScreenState, ScorescreenModel, ScoreScreenArgs, ScoreScreenDependency, ScoreScreenAction> {
override fun build(args: ScoreScreenArgs?) =
ScoreScreenLoop(
model = ScoreScreenModel(),
renderer = ScoreScreenRenderer(),
args = args,
)
}
}
By creating a builder, the Loop can be re-created by the UI with the given input arguments whenever necessary.
Utilities for using hurok with Compose Multiplatform
This package contains the LoopView which can be used to attach a com.ekezet.hurok.Loop to a @Composable
function.
For example:
@Composable
fun ScoreScreenView() {
LoopView(ScoreScreenLoop) {
Column {
Text(text = playerName)
Text(text = score)
Button(onClick = { emit(OnUpdateScoreClick) }) {
Text(text = "Update score")
}
}
}
}
In the above example ScoreScreenLoop
is a com.ekezet.hurok.LoopBuilder. A com.ekezet.hurok.LoopBuilder(com.ekezet.hurok.LoopBuilder) is used to create a com.ekezet.hurok.Loop by passing optional arguments and is needed to re-create the given com.ekezet.hurok.Loop when the function leaves the composition (e.g. a configuration change).
class ScoreScreenLoop(
model: ScoreScreenModel,
renderer: Renderer<ScoreScreenModel, ScoreScreenDependency, ScoreScreenState>,
args: ScoreScreenArgs? = null,
firstAction: ScoreScreenAction? = null,
dependency: ScoreScreenDependency? = null,
effectContext: CoroutineContext = DispatcherProvider.IO,
) : Loop<ScoreScreenState, ScoreScreenModel, ScoreScreenArgs, ScoreScreenDependency, ScoreScreenAction>(
model,
renderer,
args,
firstAction,
dependency,
effectContext,
) {
companion object Builder :
LoopBuilder<ScoreScreenState, ScorescreenModel, ScoreScreenArgs, ScoreScreenDependency, ScoreScreenAction> {
override fun build(args: ScoreScreenArgs?) =
ScoreScreenLoop(
model = ScoreScreenModel(),
renderer = ScoreScreenRenderer(),
args = args,
)
}
}
By creating a builder, the com.ekezet.hurok.Loop can be re-created by the UI with the given input arguments whenever necessary.
Types
Common ViewModel for storing a Loop.
Properties
Functions
Collects state values from this Loop as a State
Collects state values from this Loop as a State
Attach a com.ekezet.hurok.Loop to a @Composable
block as a state receiver.