General questions should be asked on StackOverflow, not here. This room focuses on development of Binding.scala.
Atry on master
Update sbt-scalajs, scalajs-com… Merge pull request #310 from sc… (compare)
Atry on master
Update scalatest to 3.2.3 Merge pull request #309 from sc… (compare)
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...
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?
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
}
}