package de.trainingstagebuch.app.utils

import kotlinx.coroutines.flow.MutableSharedFlow

object UiEventFlowUtils {
    fun <T> createEventFlow(
        extraBufferCapacity: Int = 1
    ): MutableSharedFlow<T> {
        return MutableSharedFlow(
            replay = 0,
            extraBufferCapacity = extraBufferCapacity
        )
    }

    fun <T> emitSafe(flow: MutableSharedFlow<T>, value: T) {
        flow.tryEmit(value)
    }
}
