Created
June 25, 2021 20:42
-
-
Save GerardPaligot/fd7d9597aeaad2818127b1d97239d436 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
job = viewModelScope.launch(Dispatchers.IO) { | |
while (isActive) { | |
if (_times.value <= 0) { | |
job?.cancel() | |
return@launch | |
} | |
delay(timeMillis = 1000) | |
_times.value -= 1 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment