Skip to content

Commit 93e3f67

Browse files
committed
Using Kotlinx HTML DSL.
1 parent 0cbd9fe commit 93e3f67

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/main/kotlin/Main.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
1+
import kotlinx.html.button
2+
import kotlinx.html.dom.create
3+
import kotlinx.html.js.button
4+
import kotlinx.html.js.div
5+
import kotlinx.html.js.onClickFunction
6+
import kotlinx.html.onClick
7+
import kotlinx.html.p
18
import kotlin.browser.document
29
import kotlin.browser.window
310

411
fun main() {
12+
val div = document.create.div {
13+
p {
14+
+"Okay..."
15+
}
16+
p {
17+
+ "Open dev tools and click the button!"
18+
}
19+
button {
20+
+"Click me..."
21+
onClickFunction = {
22+
println("Who-hoo! ${it.type}")
23+
}
24+
}
25+
}
526
document.addEventListener("DOMContentLoaded", {
627
console.log("Are you ready for a good jam?")
728
document.querySelector("#app")?.let {
829
window.setTimeout({
930
it.textContent = "Хола! Их бин Максимко O.o"
31+
it.appendChild(div)
1032
}, 1234)
1133
}
1234
}, false)

0 commit comments

Comments
 (0)