Updated on 2026-08-14
This commit is contained in:
parent
86139d5f45
commit
480f66e8b2
4 changed files with 70 additions and 41 deletions
|
|
@ -3,7 +3,9 @@ package com.tangem.utils.coroutines
|
|||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
|
|
@ -13,6 +15,12 @@ suspend fun <R> runCatching(dispatcher: CoroutineDispatcher, block: suspend () -
|
|||
}
|
||||
}
|
||||
|
||||
suspend inline fun ifActive(crossinline block: suspend () -> Unit) = coroutineScope {
|
||||
if (isActive) {
|
||||
block()
|
||||
}
|
||||
}
|
||||
|
||||
class Debouncer {
|
||||
|
||||
private var debounceJob: Job? = null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue