Package

com.thoughtworks

binding

Permalink

package binding

Visibility
  1. Public
  2. All

Type Members

  1. class LatestEvent[E <: Event] extends Binding[Option[E]]

    Permalink

    Author:

    杨博 (Yang Bo)

Value Members

  1. object LatestEvent

    Permalink
  2. object LatestHTMLEvents

    Permalink

    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

    Example:
    1. 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

      def clientXBinding = Binding {
        val mouseEvent: Option[MouseEvent] = latestClickEvent.bind
        mouseEvent.map(_.clientX)
      }

Ungrouped