Added UiService to debounce actions

This commit is contained in:
dankito 2024-09-09 17:09:44 +02:00
parent 76487f201b
commit f5bd69868e
2 changed files with 16 additions and 0 deletions

View File

@ -31,6 +31,8 @@ object DI {
val accountTransactionsFilterService = AccountTransactionsFilterService()
val uiService = UiService()
var bankingRepository: BankingRepository = InMemoryBankingRepository(emptyList())

View File

@ -0,0 +1,14 @@
package net.codinux.banking.ui.service
import kotlinx.coroutines.*
class UiService {
fun debounce(coroutineScope: CoroutineScope, action: () -> Unit): Job {
return coroutineScope.launch {
delay(250)
action()
}
}
}