Added UiService to debounce actions
This commit is contained in:
parent
76487f201b
commit
f5bd69868e
|
@ -31,6 +31,8 @@ object DI {
|
|||
|
||||
val accountTransactionsFilterService = AccountTransactionsFilterService()
|
||||
|
||||
val uiService = UiService()
|
||||
|
||||
|
||||
var bankingRepository: BankingRepository = InMemoryBankingRepository(emptyList())
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue