mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-23 00:57: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
|
replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize
|
||||||
): StateFlow<T?> = asStateFlow(null, scope, replayCacheSize)
|
): 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
|
channelSize
|
||||||
).let {
|
).let {
|
||||||
it to it.asStateFlow(initial, scope, replayCacheSize)
|
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