Wizard: add support of JS singleplatform projects
This commit is contained in:
+12
@@ -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)
|
||||
}
|
||||
}
|
||||
+8
-5
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user