These are chat archives for ThoughtWorksInc/Binding.scala

22nd
Jan 2017
Darcy Shen
@sadhen
Jan 22 2017 12:02
agree with @jfilali
I opened #42
@fxml is designed for JavaFX
jfilali
@jfilali
Jan 22 2017 12:04
you can do that :
import com.thoughtworks.binding., Binding.
import org.scalajs.dom.document
import org.scalajs.dom.raw.Node
case class MyComponentBuilder() {

  def render = this

  var foo: Binding[String] = _

  @dom def build = <button>{foo.bind}</button>

}

implicit def autoBinding[A](a: A): Binding[A] = ???

implicit final class CustomTags(x: dom.Runtime.TagsAndTags2.type) {

  def MyComponent() = MyComponentBuilder()

}

implicit def toHtml(x: MyComponentBuilder): BindingSeq[Node] = {
  Constants(x.build).mapBinding(identity)
}


@dom def main = {
  <div><MyComponent foo="Hello, World"/></div>
}

dom.render(document.body, main)
Darcy Shen
@sadhen
Jan 22 2017 12:08
Is this code snippet runnable?
I got your ideas
jfilali
@jfilali
Jan 22 2017 12:09
yes, this directly from @Atry , thank to him,
Darcy Shen
@sadhen
Jan 22 2017 12:12
It is not runnable in ScalaFiddle
What Binding.scala version should I use
jfilali
@jfilali
Jan 22 2017 12:15
Because of the macro. Try directly on any IDE.
Darcy Shen
@sadhen
Jan 22 2017 12:15
using Binding.scala 10?
or the lastest branch ?
jfilali
@jfilali
Jan 22 2017 12:16
I'm using 11.x, I would be able to tell you if it work with 10
But it should works since you are using only @dom
Darcy Shen
@sadhen
Jan 22 2017 13:19
I implemented the autoBinding[A] function, and it works in ScalaFiddle
I'm sorry! I was too lazy to try and think
It works fine with Binding.scala 10
Since ScalaFiddle is built using SemanticUI
it is convenient to try Binding.scala with SemanticUI in ScalaFiddle
just found the secret to make ScalaFiddle snippets more fun
jfilali
@jfilali
Jan 22 2017 19:43
Good one, actually, that was my idea. building a wrapper for semantic using Binding.scala plus some utilities methods to similar to relay, react, redux.
@sadhen are you interested to work on it with me ? something likehttp://react.semantic-ui.com/introduction