Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thoughtworksinc/todo
Binding.scala • TodoMVC
https://github.com/thoughtworksinc/todo
dom reactive-programming scala scalajs starter-kit
Last synced: 2 days ago
JSON representation
Binding.scala • TodoMVC
- Host: GitHub
- URL: https://github.com/thoughtworksinc/todo
- Owner: ThoughtWorksInc
- Created: 2016-04-11T10:34:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-03-03T01:14:25.000Z (9 months ago)
- Last Synced: 2024-04-14T05:25:15.931Z (7 months ago)
- Topics: dom, reactive-programming, scala, scalajs, starter-kit
- Language: Scala
- Homepage: https://thoughtworksinc.github.io/todo/
- Size: 20.2 MB
- Stars: 59
- Watchers: 12
- Forks: 8
- Open Issues: 7
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
[Binding.scala](https://github.com/ThoughtWorksInc/Binding.scala) is a data-binding framework for [Scala](http://www.scala-lang.org/), running on both JVM and [Scala.js](http://www.scala-js.org/).
When combining with [html.scala](https://github.com/Atry/html.scala), Binding.scala can be used as a **[reactive](https://en.wikipedia.org/wiki/Reactive_programming) web framework**.
It enables you use native XML literal syntax to create reactive DOM nodes,
which are able to automatically change whenever the data source changes.Binding.scala's TodoMVC application has the tiniest code size among all the TodoMVC implementations,
only one source file, 154 lines of code!## Getting Started
``` scala
/**
* Returns a bindable HTML DOM tree.
*
* The `html"""..."""` interpolation enables two magics:
* 1. HTML literals to create DOM nodes
* 2. `xxx.bind` syntax, which makes this DOM tree keep updated whenever `xxx` changes.
*/
def rootView = {
val value = Var("")
html""""""
event.currentTarget.asInstanceOf[HTMLInputElement].value }/>
Your input value is ${ value.bind }
}/**
* Renders a bindable HTML DOM node into the body of current web page.
*/
@JSExport def main(): Unit = {
render(document.body, rootView)
}
```## Instructions to build this application
1. Download and install [sbt](http://www.scala-sbt.org/)
2. Clone this repository `git clone https://github.com/ThoughtWorksInc/todo.git`
3. Execute the shell command `sbt indexHtml` at the base directory of this code base.
4. Open the generated `index.html` in your browser. Enjoy it! 😋## Links
* [The Binding.scala Project Page](https://github.com/ThoughtWorksInc/Binding.scala)
* [This “Binding.scala • TodoMVC” Project Page](https://github.com/ThoughtWorksInc/todo)
* [This “Binding.scala • TodoMVC” DEMO](https://thoughtworksinc.github.io/todo)
* [API documentation](https://javadoc.io/page/com.thoughtworks.binding/unidoc_2.11/latest/com/thoughtworks/binding/package.html)
* [Other live DEMOs](https://thoughtworksinc.github.io/Binding.scala/)
* [Chat on Gitter](https://gitter.im/ThoughtWorksInc/Binding.scala)
* [html.scala](https://github.com/Atry/html.scala)