Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Composable
fun TimerScreen() {
val scope = rememberCoroutineScope()
Column {
Button(onClick = {
println("Timer started")
scope.launch {
try {
startTimer(5000) {
println("Timer ended")
}
} catch (ex: Exception) {
println("Timer cancelled")
}
}
}) {
Text("Start Timer")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment