renamed key to 'index'; all virtual components have a 'key' attribute
This commit is contained in:
parent
5838271f8b
commit
91d7ba25ea
5 changed files with 37 additions and 41 deletions
|
|
@ -15,7 +15,7 @@ proc `width=`(n: Node, w: int) {.importcpp: "#.width = #".}
|
|||
proc mplayer*(id, resource: cstring): VNode {.compact.} =
|
||||
proc handler(ev: Event; n: VNode) =
|
||||
let myVideo = document.getElementById(id)
|
||||
case n.key
|
||||
case n.index
|
||||
of Play:
|
||||
if myVideo.paused:
|
||||
myVideo.play()
|
||||
|
|
@ -27,13 +27,13 @@ proc mplayer*(id, resource: cstring): VNode {.compact.} =
|
|||
else: discard
|
||||
|
||||
result = buildHtml(tdiv):
|
||||
button(onclick=handler, key=Play):
|
||||
button(onclick=handler, index=Play):
|
||||
text "Play/Pause"
|
||||
button(onclick=handler, key=Big):
|
||||
button(onclick=handler, index=Big):
|
||||
text "Big"
|
||||
button(onclick=handler, key=Small):
|
||||
button(onclick=handler, index=Small):
|
||||
text "Small"
|
||||
button(onclick=handler, key=Normal):
|
||||
button(onclick=handler, index=Normal):
|
||||
text "Normal"
|
||||
br()
|
||||
br()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue