Created
September 29, 2021 07:52
-
-
Save droid-it/d1c410b741157284892f896e6616e5a2 to your computer and use it in GitHub Desktop.
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
@Composable | |
fun Timer() { | |
val timerDuration = 5000L | |
println("Composing Timer") | |
LaunchedEffect(key1 = Unit, block = { | |
startTimer(timerDuration) { | |
println("Timer ended") | |
} | |
}) | |
} | |
suspend fun startTimer(time: Long, onTimerEnd: () -> Unit) { | |
delay(timeMillis = time) | |
onTimerEnd() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment