These are chat archives for ThoughtWorksInc/Binding.scala

Feb 2018
Binh Nguyen
Feb 19 2018 15:28
alpaka 0.17 has been tagged and updated on the website but looks like no maven artifact yet . Anyone know how low will it take?
Sandro Gržičić
Feb 19 2018 21:25
hi guys, I am new to Binding.scala, but I like using it so far; I have created a simple scala.js app with two pages and am trying now to "link" the Binding router to the dom.render method. However everything I try gives me a compile time error.
the code is really basic so I will try to experiment further, but I really don't understand the compile error:

in my main method: dom.render(document.body, router.currentRoute)

in my router: @dom def currentRoute: Binding[_ <: Node] = router.state.bind.view.bind
where view is: view: Binding[_ <: Node]

I also tried removing the .bind, removing the @dom, etc. - nothing works; if I replace the .bind with .value (and remove @dom) then it compiles but as expected, doesn't change the view when the hash changes (it only correctly loads the initial view when I reload the page)
Sandro Gržičić
Feb 19 2018 21:30
and my error is usually something like:
[error]  found   : _$2(in method currentRoute) => _$2(in method currentRoute) where type _$2(in method currentRoute) <: org.scalajs.dom.raw.Node
[error]  required: _$2(in value $anonfun) => _$2(in method currentRoute) where type _$2(in method currentRoute) <: org.scalajs.dom.raw.Node, type _$2(in value $anonfun) <: org.scalajs.dom.raw.Node
I'll continue trying but I would appreciate any help; it seems like such a simple thing to do and I am failing at it.
I'm using scala.js 0.6.22 and Binding.scala 11.0.1 (dom, futurebinding, route)
Sandro Gržičić
Feb 19 2018 22:58
Interesting. The exact some code now works. I first put in some HTML inside the method, and put the router.state.bind.view.bind inside some curly braces, and that worked, then I reverted all the changes and now that works too. Weird
[edit] Just ran the code and it works beautifully. When I change the URL hash (#) by clicking on a nav link, the view re-renders. Awesome.