Hi guys, I have a problem in my little project web, well I try to run it in google chrome, but the problem displays this error JsException: Exception was thrown while running JavaScript code kotlinx.coroutines.error_$external_fun@ composeApp.uninstantiated.mjs:187 , in the console. Any suggest or any advice?, or someone has the same problem?.
This is my App function:
@Composable
fun App() {
MaterialTheme {
var showContent by remember { mutableStateOf(false) }
Column(
modifier = Modifier
.safeContentPadding()
.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Button(onClick = { showContent = !showContent }) {
Text(“Click me!”)
}
AnimatedVisibility(showContent) {
val greeting = remember { Greeting().greet() }
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
Image(painterResource(Res.drawable.compose_multiplatform), null)
Text(“Compose: $greeting”)
}
}
}
}
}
and this is my main function:
@OptIn(ExperimentalComposeUiApi::class)
fun main() {
val exceptionHandler = CoroutineExceptionHandler { _, exception →
println(“Caught exception: $exception”)
}
GlobalScope.launch(exceptionHandler) {
// Code that might throw an exception
throw IllegalStateException("Something went wrong!")
}
ComposeViewport(document.body!!) {
App()
}
}