Skip to content

//reactivestate-core/com.ensody.reactivestate/debounceWorker

debounceWorker

[common]\ fun <T, R> Flow<T>.debounceWorker(timeoutMillis: Long = 0, transform: FlowTransform<T, R>): Flow<R>

Executes each lambda in a Flow using debounce and map.

Warning: This will not compute anything if new entries keep coming in at a rate faster than timeoutMillis! This also adds a delay before the first execution!

Especially in UIs you’ll usually want to:

  • execute as quickly as possible, so that the UI feels snappy
  • get intermediate results to provide some feedback

This is why you’ll usually want to use conflatedWorker.

Parameters

common

timeoutMillis The debounce timeout.