fixing web-app

This commit is contained in:
stefan
2025-09-23 11:36:12 +02:00
parent 232ba1f86d
commit 5f974500ac
40 changed files with 287 additions and 2408 deletions
+28
View File
@@ -0,0 +1,28 @@
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
plugins {
alias(libs.plugins.kotlin.multiplatform)
}
kotlin {
jvm()
js {
browser()
}
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
}
sourceSets {
commonMain.dependencies {
// put your Multiplatform dependencies here
}
commonTest.dependencies {
implementation(libs.kotlin.test)
}
}
}
@@ -0,0 +1,3 @@
package at.mocode
const val SERVER_PORT = 8080
@@ -0,0 +1,9 @@
package at.mocode
class Greeting {
private val platform = getPlatform()
fun greet(): String {
return "Hello, ${platform.name}!"
}
}
@@ -0,0 +1,7 @@
package at.mocode
interface Platform {
val name: String
}
expect fun getPlatform(): Platform
@@ -0,0 +1,12 @@
package at.mocode
import kotlin.test.Test
import kotlin.test.assertEquals
class SharedCommonTest {
@Test
fun example() {
assertEquals(3, 1 + 2)
}
}
@@ -0,0 +1,7 @@
package at.mocode
class JsPlatform: Platform {
override val name: String = "Web with Kotlin/JS"
}
actual fun getPlatform(): Platform = JsPlatform()
@@ -0,0 +1,7 @@
package at.mocode
class JVMPlatform: Platform {
override val name: String = "Java ${System.getProperty("java.version")}"
}
actual fun getPlatform(): Platform = JVMPlatform()
@@ -0,0 +1,7 @@
package at.mocode
class WasmPlatform: Platform {
override val name: String = "Web with Kotlin/Wasm"
}
actual fun getPlatform(): Platform = WasmPlatform()