mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-22 16:47:15 +00:00
small refactoring of BroadcastStateFlow
This commit is contained in:
parent
e2d1c5d6a1
commit
4582e0c817
@ -45,11 +45,19 @@ fun <T> BroadcastChannel<T?>.asStateFlow(
|
||||
replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize
|
||||
): StateFlow<T?> = asStateFlow(null, scope, replayCacheSize)
|
||||
|
||||
fun <T> broadcastStateFlow(initial: T, scope: CoroutineScope, channelSize: Int = Channel.BUFFERED, replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize) = BroadcastChannel<T>(
|
||||
fun <T> broadcastStateFlow(
|
||||
initial: T, scope: CoroutineScope,
|
||||
channelSize: Int = Channel.BUFFERED,
|
||||
replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize
|
||||
) = BroadcastChannel<T>(
|
||||
channelSize
|
||||
).let {
|
||||
it to it.asStateFlow(initial, scope, replayCacheSize)
|
||||
}
|
||||
|
||||
fun <T> broadcastStateFlow(scope: CoroutineScope, channelSize: Int = Channel.BUFFERED, replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize) = broadcastStateFlow<T?>(null, scope, channelSize, replayCacheSize)
|
||||
fun <T> broadcastStateFlow(
|
||||
scope: CoroutineScope,
|
||||
channelSize: Int = Channel.BUFFERED,
|
||||
replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize
|
||||
) = broadcastStateFlow<T?>(null, scope, channelSize, replayCacheSize)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user