removed the need to call karax.init explicitly
This commit is contained in:
parent
d9bb8d99e8
commit
5bc7d4e336
5 changed files with 9 additions and 20 deletions
|
|
@ -10,9 +10,6 @@
|
|||
<div id="ROOT" />
|
||||
|
||||
<script type="text/javascript" src="nimcache/playerapp.js"></script>
|
||||
<script type="text/javascript">
|
||||
onload()
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,3 @@ proc createDom(): VNode =
|
|||
mplayer("vid4", url)
|
||||
|
||||
setRenderer createDom
|
||||
|
||||
proc onload() {.exportc.} =
|
||||
init()
|
||||
|
|
|
|||
|
|
@ -11,9 +11,6 @@
|
|||
<div id="ROOT" />
|
||||
|
||||
<script type="text/javascript" src="nimcache/todoapp.js"></script>
|
||||
<script type="text/javascript">
|
||||
onload()
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -106,11 +106,8 @@ proc createDom(): VNode =
|
|||
text "Clear completed (" & &completedCount & ")"
|
||||
|
||||
setOnHashChange(proc(hash: cstring) =
|
||||
if hash == cstring"#/": filter = all
|
||||
elif hash == cstring"#/completed": filter = completed
|
||||
elif hash == cstring"#/active": filter = active
|
||||
if hash == "#/": filter = all
|
||||
elif hash == "#/completed": filter = completed
|
||||
elif hash == "#/active": filter = active
|
||||
)
|
||||
setRenderer createDom
|
||||
|
||||
proc onload() {.exportc.} =
|
||||
init()
|
||||
|
|
|
|||
|
|
@ -112,14 +112,11 @@ var
|
|||
dorender: proc (): VNode {.closure.}
|
||||
currentTree: VNode
|
||||
|
||||
proc setRenderer*(renderer: proc (): VNode) =
|
||||
dorender = renderer
|
||||
|
||||
proc setTimeout*(action: proc(); ms: int): Timeout {.importc, nodecl.}
|
||||
proc clearTimeout*(t: Timeout) {.importc, nodecl.}
|
||||
#proc targetElem*(e: Event): Element = cast[Element](e.target)
|
||||
|
||||
proc getElementById*(id: cstring): Element {.importc: "document.getElementById", nodecl.}
|
||||
proc getElementById(id: cstring): Element {.importc: "document.getElementById", nodecl.}
|
||||
|
||||
#proc getElementsByClassName*(cls: cstring): seq[Element] {.importc:
|
||||
# "document.getElementsByClassName", nodecl.}
|
||||
|
|
@ -259,9 +256,13 @@ proc redraw*() =
|
|||
else:
|
||||
dodraw()
|
||||
|
||||
proc init*() =
|
||||
proc init(ev: Event) =
|
||||
reqFrame(dodraw)
|
||||
|
||||
proc setRenderer*(renderer: proc (): VNode) =
|
||||
dorender = renderer
|
||||
window.onload = init
|
||||
|
||||
proc scrollTop*(e: Node): int {.importcpp: "#.scrollTop", nodecl.}
|
||||
proc offsetHeight*(e: Node): int {.importcpp: "#.offsetHeight", nodecl.}
|
||||
proc offsetTop*(e: Node): int {.importcpp: "#.offsetTop", nodecl.}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue