sjrd on 0.6.x
Remove dead code: specific coll… Adapt the signature of `js.Arra… Merge pull request #3554 from s… (compare)
sjrd on master
Fix analyzer cycle detection to… Add toString methods to analyze… Do not provide linked ClassInfo… and 1 more (compare)
sjrd on master
Remove Logger.success It is un… Make level helpers final Clean-up ScalaConsoleLogger cod… and 1 more (compare)
The issue with using Sodium on Scala.js is that Sodium requires Java finalizers for its memory management, and Javascript does not allow for these to be implemented. They are impossible to implement in Javascript, so (unless I am wrong) Scala.js can't possibly have done it. Note that this will only leak memory if you use the Sodium 'switch' primitive, because the issue is in cleaning up Sodium objects that are no longer used, and this can only happen when you use 'switch'.
js.Dynamic.global.require("net")
to import the library
createServer
whats the scalajs way of passing a promise to it?
val titleS=STextArea(title)
val button=SButton()
button.sClickedSink.snapshot(titleS.cell).listen(println)
<.div(
titleS.component(),
button.getVDOM()
)
MouseEvent.target
returns an EventTarget
instead of a HTMLElement
when clicked inside an iframe.
val iframe = document.createElement("iframe")
document.body.appendChild(iframe)
val iframeWindow = iframe.asInstanceOf[HTMLIFrameElement].contentWindow
iframeWindow.document.body.innerHTML = "<h1>iframe</h1>"
val clicked: js.Function1[MouseEvent, Unit] = (e: MouseEvent) => {
e.target match {
case e: HTMLElement => console.log("clicked an HTMLElement", e)
case e: EventTarget => console.log("clicked an EventTarget", e)
}
}
iframeWindow.document.addEventListener("click", clicked)
When I click inside the iframe on the <h1>iframe</h1>
, I get an EventTarget
instead of an HTMLElement
. Why and how to solve it?
case e: HTMLElement
case HTMLElement
?
e
e1
?