项目作者: scalamorphing
项目描述 :
scala{js}.map(_ + rx{variable, expression})
高级语言: Scala
项目地址: git://github.com/scalamorphing/rxwind.git
RxWind
Conception
- RxGraph: change propagation graph
- RxVar: atomic mutable value
- RxExpr: expression of RxVars
RxGraph { graph =>
val name = RxVar("YourName")
val uuid = RxExpr {
name().map(_ => UUID.getNew)
}
}
RxGraph { graph =>
val credentials = RxVar {
Credentials(
firstName = "YourFirstName",
lastName = "YourLastName",
passwordHash = bcrypt.encode("password")
)
}
val databaseConnection = RxVar {
sqlStore.connect
}
val token = RxExpr {
credentials() map {
case Credentials(firstName, lastName, passwordHash) => {
if (
bcrypt.encode(s"$prefix$passwordHash$suffix") ==
sqlStore.connect.map(_.getPassword)
) {
UUID.getNew
} else {
new PasswordMismatch
}
}
}
}
}