|
|
|
|
|
by renegadus
2743 days ago
|
|
Interesting. Just for fun I created a side-by-side with Kweb of one of their simple examples. Here is kerax: var lines: seq[kstring] = @[]
proc createDom(): VNode =
result = buildHtml(tdiv):
button:
text "Say hello!"
proc onclick(ev: Event; n: VNode) =
lines.add "Hello simulated universe"
for x in lines:
tdiv:
text x
setRenderer createDom
Here is the equivalent in Kweb: fun main() {
Kweb(port = 2734) {
doc.body.new {
button().text("Say hello!").on.click {
println("Hello simulated universe")
}
}
}
}
This compiles and works. |
|