Skip to content

Instantly share code, notes, and snippets.

Last active Sep 28, 2021
What would you like to do?
fun TimerScreen() {
LaunchedEffect(key1 = Unit, block = {
try {
startTimer(5000L) { // start a timer for 5 secs
println("Timer ended")
} catch(ex: Exception) {
println("timer cancelled")
suspend fun startTimer(time: Long, onTimerEnd: () -> Unit) {
delay(timeMillis = time)
Copy link

How about the startTimer function will be implemented. I want to run the example. But I could not implement the function.

Copy link

Hey, sorry for missing that piece out. You can refer to it in the updated gist above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment