Skip to content

Instantly share code, notes, and snippets.

Last active September 28, 2021 11:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save droid-it/e4aa27cfb3afd001415fcb94567e3bba to your computer and use it in GitHub Desktop.
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