Yan Pujante
06/18/2023, 6:39 PMfun CoroutineScope.uiTimer(period: Duration,
block: suspend CoroutineScope.() -> Unit): Job {
return launch(Dispatchers.Main) {
while(isActive)
{
delay(period.inWholeMilliseconds)
if(isActive)
block(this)
}
}
}
which now fails with this error: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core'
Since it is a desktop app, I am not sure that the suggestion is the right one... the whole point was to create a timer that runs in the UI thread. Any idea what is the "right" way to do this with a more recent version of compose?ephemient
06/18/2023, 6:41 PMephemient
06/18/2023, 6:42 PMephemient
06/18/2023, 6:46 PMYan Pujante
06/18/2023, 6:46 PMYan Pujante
06/18/2023, 6:47 PMephemient
06/18/2023, 6:49 PMYan Pujante
06/18/2023, 6:52 PMYan Pujante
06/18/2023, 6:53 PMephemient
06/18/2023, 6:54 PMephemient
06/18/2023, 6:55 PMAlexander Maryanovsky
06/19/2023, 6:28 AMplugins {
kotlin("jvm") version "1.8.20"
id("org.jetbrains.compose") version "1.4.0"
}
dependencies {
implementation(compose.desktop.currentOs)
}