Wizard: add support of JS singleplatform projects

This commit is contained in:
Ilya Kirillov
2020-01-21 18:05:15 +03:00
parent b9226ce54f
commit dc26138da3
18 changed files with 121 additions and 30 deletions
@@ -0,0 +1,12 @@
import kotlin.browser.document
import kotlin.test.Test
import kotlin.test.assertEquals
class TestClient {
@Test
fun testSayHello() {
val container = document.createElement("div")
container.sayHello()
assertEquals("Hello from JS", container.textContent)
}
}
@@ -1,14 +1,17 @@
import kotlinx.html.div
import kotlinx.html.dom.append
import org.w3c.dom.Node
import kotlin.browser.document
import kotlin.browser.window
fun main() {
window.onload = {
document.body?.append {
div {
+"Hello from JS"
}
window.onload = { document.body?.sayHello() }
}
fun Node.sayHello() {
append {
div {
+"Hello from JS"
}
}
}