diff --git a/experiments/carousel.html b/examples/carousel/carousel.html similarity index 100% rename from experiments/carousel.html rename to examples/carousel/carousel.html diff --git a/experiments/carousel.nim b/examples/carousel/carousel.nim similarity index 86% rename from experiments/carousel.nim rename to examples/carousel/carousel.nim index a820be7..c2db56c 100644 --- a/experiments/carousel.nim +++ b/examples/carousel/carousel.nim @@ -5,7 +5,7 @@ import vdom, vstyles, karax, karaxdsl, jdict, jstrutils, kdom type Carousel = ref object of VComponent counter: int - cntdown, myid: int + cntdown: int timer: TimeOut list: seq[cstring] @@ -44,21 +44,14 @@ proc render(x: VComponent): VNode = button(onclick = onclick): text "Next" tdiv(style = style(StyleAttr.color, col)): - text "This changes its color." & &self.myid + text "This changes its color." if self.cntdown != ticksUntilChange: text &self.cntdown -var gid: int - proc carousel(): Carousel = result = newComponent(Carousel, render) result.list = images result.cntdown = ticksUntilChange - result.myid = gid - inc gid - #result.onAttach = proc (_: VComponent) = - # result.cntdown = ticksUntilChange - # kout cstring"attached!" proc createDom(): VNode = result = buildHtml(table): diff --git a/examples/carousel/carousel.nims b/examples/carousel/carousel.nims new file mode 100644 index 0000000..1451fc0 --- /dev/null +++ b/examples/carousel/carousel.nims @@ -0,0 +1 @@ +--path: "../../src" diff --git a/experiments/carousel.nims b/experiments/carousel.nims deleted file mode 100644 index 6b5771c..0000000 --- a/experiments/carousel.nims +++ /dev/null @@ -1 +0,0 @@ ---path: "../src" diff --git a/tests/tester.nim b/tests/tester.nim index 5dc7426..e2d7cfd 100644 --- a/tests/tester.nim +++ b/tests/tester.nim @@ -11,5 +11,6 @@ proc main = exec("nim js examples/todoapp/todoapp.nim") exec("nim js examples/scrollapp/scrollapp.nim") exec("nim js examples/mediaplayer/playerapp.nim") + exec("nim js examples/carousel/carousel.nim") main()