Skip to content

Commit f000a98

Browse files
Add js target
1 parent afaa4a6 commit f000a98

File tree

7 files changed

+3124
-2
lines changed

7 files changed

+3124
-2
lines changed

gradle.properties

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
kotlin.code.style=official
2+
kotlin.js.compiler=ir
23

34
#Gradle
45
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
@@ -9,4 +10,7 @@ android.useAndroidX=true
910

1011
#MPP
1112
kotlin.mpp.androidSourceSetLayoutVersion=2
12-
kotlin.mpp.enableCInteropCommonization=true
13+
kotlin.mpp.enableCInteropCommonization=true
14+
15+
#Compose
16+
org.jetbrains.compose.experimental.jscanvas.enabled=true

kotlin-js-store/yarn.lock

+3,065
Large diffs are not rendered by default.

lazy-pagination-compose/build.gradle.kts

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import org.jetbrains.compose.ExperimentalComposeLibrary
22
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
33
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4+
import org.jetbrains.kotlin.ir.backend.js.compile
45

56
plugins {
67
alias(libs.plugins.kotlinMultiplatform)
@@ -23,6 +24,11 @@ kotlin {
2324
iosArm64()
2425
iosSimulatorArm64()
2526

27+
js {
28+
browser()
29+
binaries.executable()
30+
}
31+
2632
sourceSets {
2733
jvmMain.dependencies {
2834
implementation(compose.desktop.currentOs)

sample/composeApp/build.gradle.kts

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ kotlin {
1818
}
1919

2020
jvm("desktop")
21-
21+
22+
js {
23+
browser()
24+
binaries.executable()
25+
}
26+
27+
2228
listOf(
2329
iosX64(),
2430
iosArm64(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import androidx.compose.ui.ExperimentalComposeUiApi
2+
import androidx.compose.ui.window.CanvasBasedWindow
3+
import org.jetbrains.skiko.wasm.onWasmReady
4+
5+
@OptIn(ExperimentalComposeUiApi::class)
6+
fun main() {
7+
onWasmReady {
8+
CanvasBasedWindow("Lazy Pagination") {
9+
App()
10+
}
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Lazy Pagination</title>
7+
<script src="skiko.js"></script>
8+
</head>
9+
<body>
10+
<div>
11+
<canvas id="ComposeTarget"></canvas>
12+
</div>
13+
<script src="composeApp.js"></script>
14+
</body>
15+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
html, body {
2+
height: 100%;
3+
margin: 0px;
4+
padding: 0px;
5+
}
6+
7+
canvas {
8+
width: 100vw;
9+
height: 100vh;
10+
display: block;
11+
position: fixed;
12+
top: 0;
13+
left: 0;
14+
}

0 commit comments

Comments
 (0)