Kthrottle

fun <T> Kthrottle(scope: CoroutineScope, period: Duration = 500.milliseconds, block: suspend (T) -> Unit): KThrottler<T>(source)

Creates and starts a KThrottler with an immediate callback.

This is a shorthand for creating a KThrottler and calling KThrottler.onThrottled.

Example usage:

private val clickThrottler = Kthrottle<Unit>(viewModelScope, 500.milliseconds) {
handleSubmit()
}

// In UI:
Button(onClick = { clickThrottler.emit(Unit) }) { ... }