These are chat archives for ThoughtWorksInc/Binding.scala

9th
Dec 2018
@Atry I've decided to hack on the meta programming part.
Wojtek Pituła
@Krever
Dec 09 2018 16:30

I have a match like the following:

val x: BindingSeq[html.TableCell] =details match {
      case AsyncState.NotStarted => ???
      case AsyncState.Pending    =>
        <td colSpan={3}><div class="ui active loader"></div></td>
      case AsyncState.Success(value)      =>
        <td>{value.jobType}</td>
        <td>${value.activityId}</td>
        <td></td>
      case AsyncState.Failure(error)         =>
        <td colSpan={3} class="error">{error.toString}</td>
    }

so I produce either one or multiple nodes. How can I make it compile? Right now compiler complains that I provide single org.scalajs.dom.html.TableCell but it expects BindingSeq[...]

杨博 (Yang Bo)
@Atry
Dec 09 2018 17:25

@sadhen I don't think we should encourage syntax like <div><MyComponent/></div>. A component is a poor man's function, which is useful in poor languages that do not have the ability of computational expressions like we have in Each or Dsl.scala.

Did you try to make MyComponent be a plain function, like <div>{ myComponent(...) }</div>?

Darcy Shen
@sadhen
Dec 09 2018 17:28
I will prove it is attractive for front end engineer
Give me three month
s
杨博 (Yang Bo)
@Atry
Dec 09 2018 17:28
@sadhen What ever, I make some of classes in Binding.scala be public in ThoughtWorksInc/Binding.scala#127 and ThoughtWorksInc/Binding.scala#123
Darcy Shen
@sadhen
Dec 09 2018 17:29
Thanks
Once the @ant annotation is proved to be useful,I d like to transfer the code to Binding.scala
杨博 (Yang Bo)
@Atry
Dec 09 2018 17:31
Good luck and have fun
@Krever If I understand correctly, <td colSpan={3} class="error">{error.toString}</td> is a single TableCell element.
Wojtek Pituła
@Krever
Dec 09 2018 17:32
yes
杨博 (Yang Bo)
@Atry
Dec 09 2018 17:33
Try Contants(<td colSpan={3} class="error">{error.toString}</td>)
Wojtek Pituła
@Krever
Dec 09 2018 17:33
will try, thanks :)