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:
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
)
}
}
ScalaTags-Rx is hosted on Maven Central,
to get started, simply add the following to your build.sbt
:
libraryDependencies += "com.timushev" %%% "scalatags-rx" % "0.1.0"
For the latest development version use:
resolvers += Resolver.sonatypeRepo("snapshots")
libraryDependencies += "com.timushev" %%% "scalatags-rx" % "0.2.0-SNAPSHOT"
=