Could an operator like the following be added to F...
# coroutines
t
Could an operator like the following be added to Flow? The debounce operator is already added, but I need one with a different timeout depending on the item. It shouldn’t be too difficult to modify the current operator to add this. I can explain my use case for this operator if needed.
Copy code
fun <T> Flow<T>.debounce(timeoutMillis: (T) -> Long): Flow<T>
👍🏻 3
o
how would that differ from
flow.filter(pred).debounce(timeout)
?
t
@octylFractal if the predicate returns true for an item the timeout should be 0 (for that item only) instead of the given
timeoutMillis
. Anyway, I changed the operator in my original message to something which makes more sense. This allows you to use a different timeout depending on the item.