Orhan Tozan
09/21/2021, 1:59 PMFlow.debounce()
and I saw it's quite complex. Now thinking about it, can't debounce be simplified to the following implementation?:
fun Flow.debounce(timeoutMillis: Long) = transformLatest {
delay(timeoutMillis)
emit(it)
}
myanmarking
09/21/2021, 3:52 PMOrhan Tozan
09/21/2021, 3:53 PMmyanmarking
09/21/2021, 3:54 PMmyanmarking
09/21/2021, 3:55 PMOrhan Tozan
09/21/2021, 3:55 PMephemient
09/21/2021, 3:56 PMOrhan Tozan
09/21/2021, 3:56 PMmyanmarking
09/21/2021, 3:56 PMmyanmarking
09/21/2021, 3:56 PMOrhan Tozan
09/21/2021, 3:58 PMOrhan Tozan
09/21/2021, 3:58 PMmyanmarking
09/21/2021, 3:58 PMmyanmarking
09/21/2021, 3:59 PMOrhan Tozan
09/21/2021, 4:00 PMuli
09/21/2021, 8:17 PMOrhan Tozan
09/21/2021, 8:44 PMuli
09/22/2021, 6:27 AM000ms: 1
050ms: 2
260ms: 3
250ms: 2 // No upstream event for 200ms since `2` was received -> emmit `2`
460ms: 3 // No upstream event for 200ms since `3` was rexeived -> emmit `3`
200ms: 1 // Take first event (`1`) and delay 200ms before emitting
400ms: 2 // Take last event before 200ms (`2`) and delay 200ms before emitting
600ms: 3 // Take last event before 400ms (`3`) and delay 200ms before emitting
1
immediately but then delay for 200ms before emitting?only emit an item from an Observable if a particular timespan has passed without it emitting another item
uli
09/22/2021, 6:39 AM