commonMain.com.copperleaf.ballast.test.internal.vm.TestInputHandlerScope.kt Maven / Gradle / Ivy
package com.copperleaf.ballast.test.internal.vm
import com.copperleaf.ballast.InputHandlerScope
import com.copperleaf.ballast.SideEffectScope
internal class TestInputHandlerScope(
private val inputHandlerScopeDelegate: InputHandlerScope, Events, State>,
) : InputHandlerScope {
override suspend fun getCurrentState(): State {
return inputHandlerScopeDelegate.getCurrentState()
}
override suspend fun updateState(block: (State) -> State) {
inputHandlerScopeDelegate.updateState(block)
}
override suspend fun updateStateAndGet(block: (State) -> State): State {
return inputHandlerScopeDelegate.updateStateAndGet(block)
}
override suspend fun getAndUpdateState(block: (State) -> State): State {
return inputHandlerScopeDelegate.getAndUpdateState(block)
}
override suspend fun postEvent(event: Events) {
inputHandlerScopeDelegate.postEvent(event)
}
override fun sideEffect(
key: String?,
onRestarted: suspend () -> Unit,
block: suspend SideEffectScope.(State) -> Unit
) {
inputHandlerScopeDelegate.sideEffect(
key = key,
onRestarted = onRestarted,
block = { TestSideEffectScope(this).block(it) }
)
}
override fun noOp() {
inputHandlerScopeDelegate.noOp()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy