Last active
December 22, 2022 00:18
-
-
Save victory316/16f51aa9b038d12af3d00ea1737e2933 to your computer and use it in GitHub Desktop.
View extensions with coroutine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun View.setDelayedJob(delayInMillis: Long, operation: () -> Unit): Job { | |
return CoroutineScope(Dispatchers.IO).launch { | |
delay(delayInMillis) | |
CoroutineScope(Dispatchers.Main).launch { | |
operation.invoke() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment