Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 07:38

    Atry on v11.8.2

    (compare)

  • 07:37

    Atry on v11.9.0

    (compare)

  • 07:33

    Atry on v11.8.2

    (compare)

  • 07:27

    Atry on 219-fix

    (compare)

  • 07:27
    Atry closed #219
  • 07:27

    Atry on master

    Always update for views and mut… Merge pull request #220 from Th… (compare)

  • 07:27
    Atry closed #220
  • 07:12
    Atry synchronize #220
  • 07:12

    Atry on 219-fix

    Always update for views and mut… (compare)

  • 01:33
    Atry reopened #219
  • 01:32
    Atry closed #219
  • 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
Nikolay Artamonov
@nartamonov
Okay, so there is hope it will be optimized in future :+1:
nawfalhasan
@nawfalhasan
I see. Fair enough..
Jordan Gwyn
@emanresusername
@Atry finally got things together here’s a complete version of the project i was asking about about before. hopefully this can be useful as a resource example using Binding.scala in the wild as well
杨博 (Yang Bo)
@Atry
@emanresusername, very impressive.
I think it can be a benchmark for DOM-based animation also
Jordan Gwyn
@emanresusername
Thanks! Hope it's at least entertaining if not useful :sweat_smile:
杨博 (Yang Bo)
@Atry
I think it would be a very good showcase for web extensions built from Scala.js + Binding.scala
The name linfinity sounds like linsanity :smile:
杨博 (Yang Bo)
@Atry
@emanresusername I guess you can wrap each row in a <pre> tag, so that the user may choose whitespace as the blank character.
Jordan Gwyn
@emanresusername
Oohh good point!
Alex Reisberg
@a-reisberg
I just came across this project. Looks very nice!
I have a quick question: how do you insert a Binding twice
for eg
  @dom val hello: Binding[Node] = <p>Hello from Binding.scala</p>

  @dom val helloTwice: Binding[Node] =
    <div>
      {hello.bind}
      {hello.bind}
    </div>
I got Cannot insert P twice!
杨博 (Yang Bo)
@Atry
Change hello to a def @a-reisberg
杨博 (Yang Bo)
@Atry
This is a limitation of DOM API, since a HTML node only has one parent
Alex Reisberg
@a-reisberg
@Atry Thanks!
so when I do .bind, hello is mutated under the hood?
Alex Reisberg
@a-reisberg
maybe it's good to have Binding[_] lazy by default
杨博 (Yang Bo)
@Atry
I did not get what does "lazy" mean
Alex Reisberg
@a-reisberg
Binding[Node] would then be approximately () => Binding[Node] in the current incarnation
杨博 (Yang Bo)
@Atry
Then you should use def by default
Alex Reisberg
@a-reisberg
yeah :)
Thanks!
杨博 (Yang Bo)
@Atry
A Binding is a container that continuously maintain its element according to upstream changes.
Alex Reisberg
@a-reisberg
Right
杨博 (Yang Bo)
@Atry
if you need two different values, you need two containers
Alex Reisberg
@a-reisberg
btw, when I have
@dom def hello: Binding[Node] = <p>Hello from Binding.scala</p>
intellij complains about type issues. Is it possible to make it go away?
Found Elem, required Binding[Node]
杨博 (Yang Bo)
@Atry
You can create an implicit view to make IntelliJ happy
Alex Reisberg
@a-reisberg
Ah, thanks.
I'm gonna keep playing with it. It seems quite nice!
杨博 (Yang Bo)
@Atry
@a-reisberg Would you mind editing FAQ to include this workaround for IntelliJ?
Alex Reisberg
@a-reisberg
Will do!
Alex Reisberg
@a-reisberg
Hi again, quick question: how do you make the following work:
@dom def hello: Binding[Node] = <p>Hello from Binding.scala</p>

@dom def helloTwice: Binding[Node] =
  <div>
    {
      (1 to 10).map(_ => Binding{hello.bind})
    }
  </div>
杨博 (Yang Bo)
@Atry
See FAQ
Alex Reisberg
@a-reisberg
I did, that's how I added the Binding
FAQ says:
someCollection.map(item => Binding { renderItem(item.bind) } )
杨博 (Yang Bo)
@Atry
(1 to 10).map(_ => Binding{hello.bind}) should compile
Alex Reisberg
@a-reisberg
that's exactly the same as what I wrote above right?
杨博 (Yang Bo)
@Atry
However, the type is Seq[Binding[Node]], which is unable to be inserted into DOM.
Alex Reisberg
@a-reisberg
oh, so I should remove the { ...}
杨博 (Yang Bo)
@Atry
You need a Seq[Node] or BindingSeq[Node] in order to insert to the DOM
So you may look at the other solutions
Alex Reisberg
@a-reisberg
Ok, I got the Constants one to work
but since this one was mentioned as one of the solutions
I thought that it might work as well
杨博 (Yang Bo)
@Atry
It does compile
Alex Reisberg
@a-reisberg
the one I copied above didn't compile