Updated on 2026-08-14

This commit is contained in:
Tangem 2024-05-27 13:11:47 +05:00
parent 0b8efe6d02
commit 2fcc9abc8e
2 changed files with 20 additions and 11 deletions

View file

@ -10,6 +10,13 @@ suspend fun <R> runCatching(dispatcher: CoroutineDispatcher, block: suspend () -
}
}
suspend fun <R> waitForDelay(delay: Long, block: suspend CoroutineScope.() -> R): R = coroutineScope {
val minWaitingTime = async { delay(delay) }
val actionInvoke = async { block() }
minWaitingTime.await()
actionInvoke.await()
}
class Debouncer {
private var debounceJob: Job? = null