Updated on 2026-08-14

This commit is contained in:
Tangem 2024-11-27 15:23:46 +05:00
parent d0d9fcfef8
commit d772beda45
11 changed files with 90 additions and 41 deletions

View file

@ -25,11 +25,12 @@ class Debouncer {
coroutineScope: CoroutineScope,
waitMs: Long = 300L,
context: CoroutineContext = EmptyCoroutineContext,
forceUpdate: Boolean = false,
destinationFunction: suspend () -> Unit,
) {
debounceJob?.cancel()
debounceJob = coroutineScope.launch(context) {
delay(waitMs)
if (!forceUpdate) delay(waitMs)
destinationFunction.invoke()
}
}