General questions should be asked on StackOverflow, not here. This room focuses on development of Binding.scala.
Atry on master
Update scalatest to 3.2.3 Merge pull request #309 from sc… (compare)
Atry on master
Update sbt-pgp to 2.1.1 Merge pull request #306 from sc… (compare)
Atry on master
Update sbt-scalajs, scalajs-com… Merge pull request #307 from sc… (compare)
Atry on master
Update sbt to 1.4.6 Merge pull request #308 from sc… (compare)
div
just for this purpose, so that wherever the div is being used, it is going to get the initializer invoked? (If you know an answer and are willing to answer on SO, I can enter a question there, too.)
dom.render()
gets called did not helpdef applyOnMount(selector: String, f: () => Unit):Unit = {
val elemFound: Boolean = org.scalajs.dom.document.body.querySelectorAll(selector).length > 0
if (!elemFound) {
println(s"waiting for elem $selector")
js.timers.setTimeout(Duration.seconds(1000).milliseconds) {
println(s"recursing for $selector")
applyOnMount(selector,f)
}
} else {
println(s"applying on elem $selector")
f
}
}
subview1
and subview2
accept Binding
as parameters instead of raw values, in order to partially rendering subviews that when only parts of store
are changed.
Var
used in the entire application.
copy
(which @atry mentioned the demo) is the killer feature (would it be a bold statement to claim that it is something JS/TS world never had?) and can implement redux very easily. and you don't code on the overly-async javascript, instead scala and execution order is not an issue afaik (once upon a time I was banging my head with promise chains). Then the redux is not necessary because the state is already there in a stable manner. In JS world keeping a global state would be very unstable and would be hard to detect and reason on who modifies what. But simply you don't have such language-originated deficiencies in ScalaJs. That's a summary of my overall impression so far.
@mcku
Using MutationObserver, I am able to use jQuery based semantic-ui components without rewriting them in binding.scala from scratch
Could you check something like this: https://gist.github.com/glmars/a597f7c28931a38e2e9b3262279889a9 ?
The main ideas are using Element
based selector in jQuery instead of string
based and initializing of control right after creation.
{t("hello").bind}
gives the correct translation. The idea came from here: https://lingui.js.org/tutorials/react-patterns.html#id1 and i think it is good, and that idea can be ported to scalajs
watch
/render
/bind
or something like this? In our case initialization after creation works well with https://getmdl.io/ and https://materializecss.com