myanmarking
03/13/2020, 6:32 PMoctylFractal
03/13/2020, 6:36 PMmyanmarking
03/13/2020, 6:39 PMoctylFractal
03/13/2020, 6:41 PMmyanmarking
03/13/2020, 6:42 PMmyanmarking
03/13/2020, 6:42 PMmyanmarking
03/13/2020, 6:43 PMstreetsofboston
03/13/2020, 6:43 PMmyanmarking
03/13/2020, 6:43 PMtseisel
03/13/2020, 6:55 PMthrottleLatest.
I started writing code to submit a PR in coroutines librarykevin.cianfarini
03/13/2020, 7:04 PMmyanmarking
03/13/2020, 7:06 PMkevin.cianfarini
03/13/2020, 7:06 PMkevin.cianfarini
03/13/2020, 7:07 PMkevin.cianfarini
03/13/2020, 7:07 PM/**
 * Consume this [Flow] using a channelFlow with no buffer. Elements emitted from [this] flow
 * are offered to the underlying [channelFlow]. If the consumer is not currently suspended and 
 * waiting for the next element, the element is dropped. 
 * 
 * @return a flow that only emits elements when the downstream [Flow.collect] is waiting for the next element
 */
fun <T> Flow<T>.drop(): Flow<T> = channelFlow {
    collect { offer(it) }
}.buffer(capacity = 0)myanmarking
03/13/2020, 7:09 PMdekans
03/14/2020, 4:45 PMconflate()? It is not exactly the same behavior but maybe it could help