These are chat archives for ThoughtWorksInc/Binding.scala

8th
Oct 2016
杨博 (Yang Bo)
@Atry
Oct 08 2016 01:02

@williamho , @sciabarra , @dom val concatenated = seq1.bind ++ seq2.bind creates new BindingSeq whenever seq1 or seq2 change.

If you want to partially update the returned BindingSeq when sources change, try for / yield instead

@dom val concatenated = {
  for {
    seq <- Constants(seq1, seq2)
    x <- seq
  } yield x
}
The behavior is important when you want to render concatenated into HTML DOM
Michele Sciabarra
@sciabarra
Oct 08 2016 15:53
hm Constants does not work
how can I just get a BindingSeq with a single node?
this one does not work
@dom override def render(): Binding[BindingSeq[Node]] =
Constants(<div id="world">
{super.render().bind}
</div>)
Michele Sciabarra
@sciabarra
Oct 08 2016 16:03
what is wrong also there:
@dom override def render(): Binding[BindingSeq[Node]] =
super.render().bind ++ this.video().bind
++ not found
I am a bit puzzled
杨博 (Yang Bo)
@Atry
Oct 08 2016 16:10
Does it compile in sbt?
Michele Sciabarra
@sciabarra
Oct 08 2016 20:36
no
/Users/msciab/Dropbox/Work/MacBookPro/Magrathea/magrathea2/client/src/main/scala/magrathea/client/world/Slides.scala:80: value ++ is not a member of com.thoughtworks.binding.Binding.BindingSeq[org.scalajs.dom.Node]
[error] super.render().bind ++