Kdebounce
fun <T> Kdebounce(scope: CoroutineScope, delay: Duration = 300.milliseconds, leading: Boolean = false, block: suspend (T) -> Unit): KDebouncer<T>(source)
Creates and starts a KDebouncer with an immediate callback.
This is a shorthand for creating a KDebouncer and calling KDebouncer.onDebounced.
Example usage:
private val searchDebouncer = Kdebounce<String>(viewModelScope) { query ->
performSearch(query)
}
// In UI:
onValueChange = { searchDebouncer.emit(it) }Content copied to clipboard