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

commonMain.de.halfbit.componental.router.Router.kt Maven / Gradle / Ivy

package de.halfbit.componental.router

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow

public abstract class Router {
    private val mutableEventFlow =
        MutableSharedFlow(extraBufferCapacity = 32)

    public val events: Flow
        get() = mutableEventFlow.asSharedFlow()

    public fun route(event: Event) {
        check(mutableEventFlow.tryEmit(event)) { "Cannot process event: $event" }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy