Skip to content

Commit d39e6aa

Browse files
Update main.kt
1 parent f58469b commit d39e6aa

File tree

1 file changed

+4
-5
lines changed
  • composeApp/src/wasmJsMain/kotlin/com/krossovochkin/chesskt

1 file changed

+4
-5
lines changed

composeApp/src/wasmJsMain/kotlin/com/krossovochkin/chesskt/main.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import kotlinx.browser.window
99
import kotlin.math.min
1010
import org.jetbrains.compose.resources.ExperimentalResourceApi
1111
import org.w3c.dom.HTMLElement
12+
import org.w3c.dom.Element
1213

1314
@OptIn(ExperimentalComposeUiApi::class, ExperimentalResourceApi::class)
1415
fun main() {
@@ -24,6 +25,7 @@ fun main() {
2425
}
2526

2627
private fun getContainerSize(): Int? {
28+
val windowWithFrame = js("window") as WindowWithFrameElement
2729
val iframe = windowWithFrame.frameElement as? HTMLElement
2830
return if (iframe != null) {
2931
min(iframe.offsetWidth, iframe.offsetHeight)
@@ -32,9 +34,6 @@ private fun getContainerSize(): Int? {
3234
}.takeIf { it > 0 }
3335
}
3436

35-
@JsName("window")
36-
external val windowWithFrame: WindowWithFrameElement
37-
38-
external interface WindowWithFrameElement : org.w3c.dom.Window {
39-
val frameElement: org.w3c.dom.Element?
37+
external interface WindowWithFrameElement {
38+
val frameElement: Element?
4039
}

0 commit comments

Comments
 (0)