Add todoapp benchmark

This commit is contained in:
Roman Vishnevskii 2017-04-24 16:00:32 +07:00
commit 02e7b40c07
218 changed files with 63168 additions and 0 deletions

View file

@ -0,0 +1,32 @@
import vdom, components, karax, karaxdsl, jdict, jstrutils
var
images: seq[cstring] = @[cstring"a", "b", "c", "d"]
proc carousel*(key: VKey): VNode {.component.} =
state:
var counter: int = 0
proc next(ev: Event; n: VNode) =
counter = (counter + 1) mod images.len
result = buildHtml(tdiv(key=key)):
text images[counter]
button(onclick = next):
text "Next"
proc createDom(): VNode =
result = buildHtml(table):
tr:
td:
carousel(0)
td:
carousel(1)
tr:
td:
carousel(2)
td:
carousel(3)
setRenderer createDom