Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 13 21:20
    scala-steward opened #233
  • Dec 12 02:52

    Atry on master

    Update scalafmt-core to 2.3.2 Merge pull request #230 from sc… (compare)

  • Dec 12 02:52
    Atry closed #230
  • Dec 12 02:50
    scala-steward opened #232
  • Dec 12 02:48
    Atry closed #218
  • Dec 12 02:47
    scala-steward opened #231
  • Dec 12 02:47
    scala-steward opened #230
  • Dec 12 02:47
    scala-steward opened #229
  • Dec 12 02:46
    scala-steward opened #228
  • Dec 12 02:46
    scala-steward opened #227
  • Dec 12 02:46
    scala-steward opened #226
  • Dec 07 10:20
    Atry commented #175
  • Dec 07 10:02
    adrobisch commented #175
  • Dec 01 21:52
    Atry commented #175
  • Dec 01 12:39
    adrobisch commented #175
  • Nov 24 09:02
    adrobisch commented #175
  • Nov 24 05:37
    Atry commented #175
  • Nov 24 03:38
    Atry commented #175
  • Nov 23 21:44
    adrobisch commented #175
  • Nov 23 21:44
    adrobisch commented #175
杨博 (Yang Bo)
@Atry
v11 fixed a bug in v10 when removing a node. The fix to ThoughtWorksInc/Binding.scala#56 performs some internal cache invalidation.
Leonid Turnaev
@glmars
Thank you, I also thought about this task :smile:
杨博 (Yang Bo)
@Atry
There could be an optimization in Scala.js scala-js/scala-js#2675, which should improve both code size and computational performance.
The IIFE can be replaced to a normal code block, considering let and const in ECMAScript 2015 code blocks has the same lifecycle as var in IIFEs.
Leonid Turnaev
@glmars
It will be great!
Thanks for the explanation.
杨博 (Yang Bo)
@Atry
You can create a PR to Scala.js if you're interested to optimize the memory usage in Scala 2.12
When compling a closure to JavaScript
  • Scala.js 2.11 create classes
  • Scala.js 2.12 create nested closures in IIFEs, which consums more memory than classes
  • Ideally, it should create plain closures in code blocks (for ECMAScript 2015 target)
Leonid Turnaev
@glmars
I understand an idea, but I'm not sure I am able to do this (because I don't know Scala.js insides very well) :worried:
杨博 (Yang Bo)
@Atry
Never mind
moritz bust
@busti
I recently had a chat with the folks over at scala/contributors and became aware of the fact that xml mode will be faded out with scala 3.
What will happen with binding.scala when that happens?
杨博 (Yang Bo)
@Atry
@Busti Where is the link of the chat
moritz bust
@busti
@Atry Seems like the discussion is still going on at https://gitter.im/scala/contributors
moritz bust
@busti
Does binding.scala use a compiler plugin to parse the contend of @dom methods differently?
Or does it rely on xml literals?
杨博 (Yang Bo)
@Atry
No. Instead, Binding.scala hacks the AST generated by the Scala parser.
moritz bust
@busti
Does that mean that an attr without a value like <foo bar></foo> is possible?
杨博 (Yang Bo)
@Atry
Are you talking about Scala 3 or the current version of Binding.scala?
moritz bust
@busti
The current version of binding.scala . Since scala xml literals are not sgml literals, the above is not valid xml.
杨博 (Yang Bo)
@Atry
I don't think Scala 2 parser accepts <foo bar></foo>
moritz bust
@busti
I recently tried it on https://astexplorer.net/ and it failed without generating ast for the "malformed" literal.
杨博 (Yang Bo)
@Atry
🤷
moritz bust
@busti
Thanks a lot for your answers :)
杨博 (Yang Bo)
@Atry

@/all Hello, Binding.scala users and contributors,

There is a discussion about the feature of XML literals in Scala 3, in which you guys may be interested.

杨博 (Yang Bo)
@Atry
@/all You may also want to have a look at the proposal of name-based XML literal at https://contributors.scala-lang.org/t/pre-sip-name-based-xml-literals/2175
Leonid Turnaev
@glmars
Hi @Atry, could you publish new release with ThoughtWorksInc/Binding.scala#90 and ThoughtWorksInc/Binding.scala#104 included?
杨博 (Yang Bo)
@Atry
Sure
Leonid Turnaev
@glmars
Thanks ;)
杨博 (Yang Bo)
@Atry
@glmars It seems that CI is broken due to absence of Oracle JDK
Leonid Turnaev
@glmars
Yeah I saw. Looks like your latest commit have fixed this! :+1:
Leonid Turnaev
@glmars
You have done a big code cleaning yesterday! :thumbsup: :star2: :smile:
Leonid Turnaev
@glmars
Binding.scala 11.2.0 already in Maven Central! :tada:
Wojtek Pituła
@Krever
Hey, sorry for asking here, but my question probably doesn't fit stack overflow either. Is there any up-to-date example/starter for binding.scala with scalajs-bundler/webpack? Or should I just try to assemble it from scratch?
Leonid Turnaev
@glmars
Unfortunately, I don't know such examples, but this should be easy! There is no something special with scalajs-bundler and Binding.scala. Binding.scala is regular Scala.js library.
Wojtek Pituła
@Krever
I see now, I got one working byt adjusting slinky starter. It was easy, but having something out of the box would be nice from increasing adoption perspective. Nevertheless I find Binding.scala an extremely nice project :)
Btw should I consider some state manager like diode/redux or this is not needed with Binding.scala ?
Leonid Turnaev
@glmars
Binding.scala works well without it
Pascal Mengelt
@pme123
@Krever I wrote once a blog about Binding.scala with Redux - see https://pme123.github.io/scala-adapters/development/binding-scala-redux/
Wojtek Pituła
@Krever
@pme123 thanks, will checki it out
Wojtek Pituła
@Krever
There is no explicit map or flatMap for Bindings, but one can use scalaz for that, right?
Wojtek Pituła
@Krever

thanks. Another thing,: how this should be expressed correctly:

class ProcessDefsSelect(allDefs: BindingSeq[ProcessDefinition], selected: Var[Option[ProcessDefinition]]) {

  @dom
  def render: Binding[html.Select] = {
    <select class="ui dropdown" onchange={e: Event => selected.value = allDefs.bind.find(_.id == e.target.asInstanceOf[html.Select].value)} >
      {for (pDef <- allDefs) yield {
      <option value={pDef.id} selected={selected.bind.exists(_.id == pDef.id)} >
        {pDef.name}
      </option>
    }}
    </select>
  }

}

simple select component. This impl doesnt work due to allDefs.bind invoked in callback function...

Wojtek Pituła
@Krever
assigning allDefs.bind to variable outside callback function works fine
Mustafa Kuscu
@mcku
I have a question https://stackoverflow.com/questions/53119126/binding-scala-component-to-string-conversion. In this Gitter channel, there was a discussion on how to convert a scalatags typed tag to string. I need a similar way to do that for a Binding[Element].
Mustafa Kuscu
@mcku
Would it be possible to use a third party library like that alongside with binding.scala? As an example, consider the example setting content of popup: https://github.com/fancellu/scalajs-leaflet/blob/master/example/src/main/scala/example/Leaflet2.scala#L25
How can i set dynamic content in the popup that depends on binding.scala content?
Maybe an idea could be to build a modified leaflet library that avoids the builders and promotes binding.scala concepts, which might be a novel approach to mapping.
Leonid Turnaev
@glmars
Why are you thinking it isn't possible? I suppose, you can try and if you will have a concrete problem, you can write stackoverflow question. As I know there is a link in Readme to an example project of the using Google maps with Binding.scala which can be helpful for you.
Mustafa Kuscu
@mcku
Well, i like using leaflet, my other project is using leaflet. The binding.scala + google maps tutorial has binding.scala components for the search box related data binding only. The map is bound to the dom by the leaflet.js itself. Therefore it is outside of the managed code, the leaflet code updates the dom directly. Therefore the problem becomes how to integrate these together. This is a similar problem in the react world, too. In the react world i was using react-leaflet for managing the lifecycle of the map's sub components (https://react-leaflet.js.org/docs/en/intro.html#lifecycle-process). But here i don't know if it is possible to extend or customize the life cycle of dom components, the map in particular, and relate them to those of the binding.scala components. It may be just easier to re-implement leaflet.js in binding.scala, because leaflet.js includes lots of custom event handling stuff which is simply redundant in the existing of binding.scala.
Mustafa Kuscu
@mcku

For instance, when a map is initialized by leaflet, the container that is associated with the map is 'marked', therefore after a re-rendering caused by .bind, the map may become unusable because it won't contain leaflet.js-originated stuff... This one can be avoided by careful coding.

But one other thing is to use a dom annotated component's value within the non-binding-aware, external library. This one i still don't know. extfunc(x.bind) would this be recalculated after x changes?