com.thoughtworks.binding
Including LatestHTMLEvents.of, which automatically infers the event type based on the type class defined in org.lrng.binding.html
Given an HTML button element,
import org.lrng.binding.html, html.autoImports.xml.attributes import org.scalajs.dom.MouseEvent @html val myButton = <button>Click me!</button>
when creating the latest click event binding with the help of LatestHTMLEvents.of,
val latestClickEvent = LatestHTMLEvents.of(myButton.value, attributes.onclick)
the event type should be inferred as org.scalajs.dom.MouseEvent,
val _ = latestClickEvent: LatestEvent[MouseEvent]
and the MouseEvent properties, like clientX, can be used in the derived Bindings
MouseEvent
clientX
def clientXBinding = Binding { val mouseEvent: Option[MouseEvent] = latestClickEvent.bind mouseEvent.map(_.clientX) }
(Since version ) see corresponding Javadoc for more information.
Including LatestHTMLEvents.of, which automatically infers the event type based on the type class defined in org.lrng.binding.html
Given an HTML button element,
when creating the latest click event binding with the help of LatestHTMLEvents.of,
val latestClickEvent = LatestHTMLEvents.of(myButton.value, attributes.onclick)
the event type should be inferred as org.scalajs.dom.MouseEvent,
val _ = latestClickEvent: LatestEvent[MouseEvent]
and the
MouseEvent
properties, likeclientX
, can be used in the derived Bindings