Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thoughtworksinc/latestevent.scala
bidirectional data-binding and routing for Scala.js
https://github.com/thoughtworksinc/latestevent.scala
data-binding dom html routing scala scalajs
Last synced: 3 days ago
JSON representation
bidirectional data-binding and routing for Scala.js
- Host: GitHub
- URL: https://github.com/thoughtworksinc/latestevent.scala
- Owner: ThoughtWorksInc
- License: mit
- Created: 2019-03-20T13:04:04.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-03T07:39:20.000Z (7 months ago)
- Last Synced: 2024-05-03T13:05:33.661Z (7 months ago)
- Topics: data-binding, dom, html, routing, scala, scalajs
- Language: Scala
- Homepage:
- Size: 241 KB
- Stars: 6
- Watchers: 21
- Forks: 2
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LatestEvent.scala
[![Latest version](https://index.scala-lang.org/ThoughtWorksinc/LatestEvent.scala/latest.svg)](https://index.scala-lang.org/ThoughtWorksinc/LatestEvent.scala)
[![Scaladoc](https://javadoc.io/badge/com.thoughtworks.binding/latestevent_sjs1_3.svg?label=scaladoc)](https://javadoc.io/page/com.thoughtworks.binding/latestevent_sjs1_3/latest/com/thoughtworks/binding/LatestEvent.html)
[![Scala CI](https://github.com/ThoughtWorksInc/LatestEvent.scala/actions/workflows/scala.yml/badge.svg)](https://github.com/ThoughtWorksInc/LatestEvent.scala/actions/workflows/scala.yml)**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](https://github.com/ThoughtWorksInc/Binding.scala) and [html.scala](https://github.com/Atry/html.scala/) for bidirectional data-binding and routing.
## Getting Started
``` scala
def rootView = {
val inputBinding = html""
val value = Binding {
val input = inputBinding.bind// Automatically recaculate whenever `input` is changed
LatestEvent.change(input).bind
input.value
}
html""""""
${inputBinding.bind}
Your input value is ${value.bind}
}@JSExport def main(): Unit = {
render(document.body, rootView)
}
```It can be also used as an alternative to a routing library. See the [todo app](https://github.com/ThoughtWorksInc/todo/commit/54921cd4e1e7acf0b119b8bcd75c1a5c3f755f67#diff-96b7940afd1d65c4c49f5b434c0c764a2f1ecb133b12537b7144a8a05531457eR40-R43) for example.
## Links
- [Binding.scala](https://github.com/ThoughtWorksInc/Binding.scala)
- [html.scala](https://github.com/Atry/html.scala)
- [The legacy Binding.scala's routing library](https://github.com/atry/route.scala)