package binding
Ordering
- Alphabetic
Visibility
- Public
- Protected
Type Members
- class LatestEvent[E <: Event] extends Binding[Option[E]]
Author:
杨博 (Yang Bo)
Value Members
- object LatestEvent
- object LatestHTMLEvents
Including LatestHTMLEvents.of, which automatically infers the event type based on the type class defined in org.lrng.binding.html
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, likeclientX
, can be used in the derived Bindingsdef clientXBinding = Binding { val mouseEvent: Option[MouseEvent] = latestClickEvent.bind mouseEvent.map(_.clientX) }
Example: