Skip to content

ThoughtWorksInc/LatestEvent.scala

Repository files navigation

LatestEvent.scala

Latest version Scaladoc Scala CI

LatestEvent.scala is a library to track the latest events from HTML DOM objects and other event targets. It can be used with Binding.scala and html.scala for bidirectional data-binding and routing.

Getting Started

def rootView = {
  val inputBinding = html"<input>"
  val value = Binding {
    val input = inputBinding.bind

    // Automatically recaculate whenever `input` is changed
    LatestEvent.change(input).bind
    
    input.value
  }
  html"""<div>
    ${inputBinding.bind}
    Your input value is ${value.bind}
  </div>"""
}

@JSExport def main(): Unit = {
  render(document.body, rootView)
}

It can be also used as an alternative to a routing library. See the todo app for example.

Links

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy