Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 09 04:00
    notyy commented #222
  • Oct 09 03:59
    notyy closed #222
  • Oct 09 03:59
    notyy commented #222
  • Oct 08 20:28
    Atry commented #223
  • Oct 08 20:28

    Atry on master

    docs: fix typo Merge pull request #223 from Ja… (compare)

  • Oct 08 20:28
    Atry closed #223
  • Oct 08 20:20
    Jason-Cooke opened #223
  • Oct 07 03:30
    glmars commented #222
  • Oct 06 04:05
    notyy opened #222
  • Oct 04 11:29
    datalchemist commented #217
  • Oct 04 11:02
    datalchemist commented #217
  • Oct 04 06:58

    Atry on scalafmt

    (compare)

  • Oct 04 06:46

    Atry on master

    Run scalafmt Merge branch 'master' into scal… Merge pull request #221 from Th… (compare)

  • Oct 04 06:46
    Atry closed #221
  • Oct 04 06:46
    Atry synchronize #221
  • Oct 04 06:46

    Atry on scalafmt

    Update scalafmt to 2.0.1 Update sbt to 1.3.2 Merge pull request #215 from sc… and 2 more (compare)

  • Oct 04 06:06
    Atry commented #217
  • Oct 04 05:30
    glmars commented #217
  • Oct 04 05:09
    Atry closed #191
  • Oct 04 05:09

    Atry on master

    Update scalafmt to 2.0.1 Merge pull request #203 from sc… (compare)

Mustafa Kuscu
@mcku
Hi @Atry, i have started using your library. I think some helpers like this may be useful for beginners. I am kind of observing that dealing with futures and bindings add up extra lines of code..
 // some helpers for binding.scala
  @dom def futureBindingToBinding[T](futureBinding: Binding[Option[Try[T]]], emptyVal: T): Binding[T] = futureBinding.bind
    .map((y:Try[T]) => y.get)
    .getOrElse(emptyVal)

  @dom def futureBindingToBindingSeq[T](futureBindingSeq: Binding[Option[Try[Seq[T]]]], emptyVal: Seq[T]): Binding[BindingSeq[T]] = {
    val tmpSeq: Seq[T] = futureBindingSeq.bind
      .map((y: Try[Seq[T]]) => y.get)
      .getOrElse(emptyVal)
    val x: BindingSeq[T] = Vars(tmpSeq: _*)
    x
  }
杨博 (Yang Bo)
@Atry
You can create your own library of these helpers. People will use your library as long as they feel useful.
Mustafa Kuscu
@mcku
It is amazing to see that yet Binding.scala is a client side JS what is executing, it is some order of magnitude faster than some of the competition.. It is type safe and no buggling with webpack and similar. Wow. I remember doing some logic from within componentDidMount (because that was the only straightforward/feasible way to do it), sometimes within seconds.. Binding scala.. same thing is done within milliseconds. Man, that is awesome..
杨博 (Yang Bo)
@Atry
Have fun!
林煒清(Lin Wei-Ching)
@superChing
Hi, this code return error, but if I put the v2 binding val into render function it works. I do not understand where's problem?
val v1:Any = 1 
@dom
val v2 = Binding {
    v1 match {
      case x:String => <p>str</p>
      case x:Int => <p>int</p>
    }
}
@dom 
def render = { <p>{v2.bind}</p> }
dom.render(document.body, render)
林煒清(Lin Wei-Ching)
@superChing
need help. thank you.
杨博 (Yang Bo)
@Atry
StackOverflow seems like a better place to ask questions like this
Kahli Burke
@kahliburke
@superChing Remove Binding from v2, it's already annotated with
@dom
林煒清(Lin Wei-Ching)
@superChing
thanks
Mustafa Kuscu
@mcku
Hi, consider an ajax method that most of the time returns the same value. Whenever that result is bound to a dom component, during the ajax call it disappears and gets re-rendered with the same value. I would like to avoid this behavior by declaring that binding to be a constant, with no success. The ajax result is a future binding which does not map into a constant. Or am i missing something here?
is it possible to have a forced constant futurebinding output?
i hope i am missing something otherwise it will eventually become seeking cumbersome ways to do kind of like 'diffing' and batched rendering?
杨博 (Yang Bo)
@Atry
@mcku The built-in FutureBinding implementation only has 79 lines of code. Feel free to copy and create your own variant of FutureBinding.
Mustafa Kuscu
@mcku
thanks, i will try that..
baank
@baank
Anyway know why this doesn't work ? https://scalafiddle.io/sf/EHdex4U/2
Binh Nguyen
@ngbinh
alpaka 0.17 has been tagged and updated on the website but looks like no maven artifact yet https://mvnrepository.com/artifact/com.lightbend.akka/akka-stream-alpakka-s3_2.12 . Anyone know how low will it take?
Sandro Gržičić
@SandroGrzicic
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ć
@SandroGrzicic
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ć
@SandroGrzicic
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.
Seung-Zin Nam
@zy4
Hi, is there a way to render raw unsanitized html like using raw() from scalatags?
Kahli Burke
@kahliburke
@zy4 You can use the innerHTML attribute on a containing tag
Seung-Zin Nam
@zy4
@kahliburke that's what I did in the end but I don't like this as a solution because I need to wait for the dom element to be rendered
so I had to wait via setTimeout for this to happen :(
So I actually would like to insert raw strings before rendering happens
Seung-Zin Nam
@zy4
@glmars the only way I could use this would be to have nested rendering. Who else would find it useful to have a native way of just embedding raw html as strings?
杨博 (Yang Bo)
@Atry
This gitter channel is really not a good place to ask or answer questions like this. Those disscussion are not searchable, and will not help other people who face the same issue.
杨博 (Yang Bo)
@Atry
@zy4 The exact same question was asked in this Gitter channel two years ago, apparently you were not able to find it, because it was not indexed by Google or indexed at a low PageRank, unfortunately.
prassee
@prassee
I have seen Binding.scala examples in ScalaFiddle are all written in Chinese is there a English version available
Seung-Zin Nam
@zy4
@Atry I will repost this on github
杨博 (Yang Bo)
@Atry
Or StackOverflow
Leonid Turnaev
@glmars
@Atry do you have any news about @html support?
prassee
@prassee
is there any example which uses routes...
Leonid Turnaev
@glmars
Pascal Mengelt
@pme123
@prassee I wrote a small framework that also uses Routing, check https://pme123.github.io/scala-adapters/. This is work in progress - but there is also a Giter.8 template to get you started.
杨博 (Yang Bo)
@Atry
Look very nice!
Pascal Mengelt
@pme123
@Atry thanks, still a big fan of this framework! Great Job!
杨博 (Yang Bo)
@Atry
:smile:
snakelenas
@snakelenas
极其优秀的一个框架,thanks !
Andrzej Sołtysik
@asoltysik
Hi, what's the maintainers' approach to documentation? I would like to contribute some routing docs/tutorial when I have time. Where should I put it?
My guess would be the wiki, I see some non-english page there (a tutorial I guess) - is it ok if I contribute a new page there?
杨博 (Yang Bo)
@Atry
@asoltysik Feel free to create new wiki pages for motive examples.
Aslo you can edit the ScalaDoc for basic concept and simple independent examples.
Ankit Soni
@ankitson

hi guys, im trying a very simple example and i dont understand why it doesnt work -

  val squareValues:List[Var[Any]] = List(
    Var(0),Var(1),Var(2)
  )

  @tdom
  def square(id: Int): Binding[Node] = {
    def clickHandler() = { (_:MouseEvent) =>
      println(f"click $id");
      squareValues(id).value="X"
    }

    <button class="square" onclick={clickHandler}>{squareValues(id).value.toString}</button>
}
   ….
    tdom.render(appRoot, square(0))

now clicking the square doesnt change whats displayed.

nvm i got it working… i mixed up bind and value
Andrzej Sołtysik
@asoltysik
You shouldn't use value inside the dom method