All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.copperleaf.ballast.test.internal.vm.TestInputHandlerScope.kt Maven / Gradle / Ivy

There is a newer version: 4.2.1
Show newest version
package com.copperleaf.ballast.test.internal.vm

import com.copperleaf.ballast.BallastLogger
import com.copperleaf.ballast.InputHandlerScope
import com.copperleaf.ballast.SideJobScope

internal class TestInputHandlerScope(
    private val inputHandlerScopeDelegate: InputHandlerScope, Events, State>,
) : InputHandlerScope {

    override val logger: BallastLogger
        get() = inputHandlerScopeDelegate.logger

    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 sideJob(
        key: String,
        block: suspend SideJobScope.() -> Unit
    ) {
        inputHandlerScopeDelegate.sideJob(
            key = key,
            block = { TestSideJobScope(this).block() }
        )
    }

    override fun noOp() {
        inputHandlerScopeDelegate.noOp()
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy