Created
June 7, 2022 19:54
-
-
Save jaozinfs/d1973aa76fa0d9f1b7b981adc7d983b3 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
fun main() = runBlocking { | |
val job = launch { | |
updateUi()... | |
coroutineScope { | |
launch { | |
downloadImage() | |
} | |
launch { | |
downloadSounds() | |
} | |
} | |
println("finish downloads") | |
updateUi()... | |
} | |
job.join() | |
println("Finish Job") | |
} | |
suspend fun downloadImage(){ | |
(1..2).onEach { | |
delay(300) | |
println("image $it") | |
} | |
} | |
suspend fun downloadSounds() { | |
(1..2).onEach { | |
delay(300) | |
println("sound $it") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment