scalatags-rx ![Build Status](https://camo.githubusercontent.com/1a383164534f2fc69723b2b435508162d7a969511fffc050945ec15fa9f3769a/68747470733a2f2f7472617669732d63692e6f72672f7274696d7573682f7363616c61746167732d72782e7376673f6272616e63683d6d6173746572)
ScalaTags-Rx is a small integration layer between ScalaTags and Scala.Rx. It provides a set of type class instances for Rx[T]
values that allows you to use them directly in a ScalaTags DSL with changes automatically propagated to the resulting DOM:
import scalatags.rx.all._
object Example extends JSApp {
val c = Var("blue")
val text = Rx(s"It is a ${c()} text!")
def toggle(): Unit = {
c() = if (c.now == "blue") "green" else "blue"
}
override def main(): Unit = {
document.body.appendChild(
div(
color := c, onclick := toggle _,
text
).render
)
}
}
Getting Started
ScalaTags-Rx is hosted on Maven Central, to get started, simply add the following to your build.sbt
:
libraryDependencies += "com.timushev" %%% "scalatags-rx" % "0.4.0"
For the latest development version use:
resolvers += Resolver.sonatypeRepo("snapshots")
libraryDependencies += "com.timushev" %%% "scalatags-rx" % "0.4.1-SNAPSHOT"