项目作者: scalamorphing

项目描述 :
scala{js}.map(_ + rx{variable, expression})
高级语言: Scala
项目地址: git://github.com/scalamorphing/rxwind.git
创建时间: 2017-02-25T10:05:51Z
项目社区:https://github.com/scalamorphing/rxwind

开源协议:

下载


RxWind

Conception

  • RxGraph: change propagation graph
  • RxVar: atomic mutable value
  • RxExpr: expression of RxVars
  1. RxGraph { graph =>
  2. val name = RxVar("YourName")
  3. val uuid = RxExpr {
  4. name().map(_ => UUID.getNew)
  5. }
  6. }
  1. RxGraph { graph =>
  2. val credentials = RxVar {
  3. Credentials(
  4. firstName = "YourFirstName",
  5. lastName = "YourLastName",
  6. passwordHash = bcrypt.encode("password")
  7. )
  8. }
  9. val databaseConnection = RxVar {
  10. sqlStore.connect
  11. }
  12. val token = RxExpr {
  13. credentials() map {
  14. case Credentials(firstName, lastName, passwordHash) => {
  15. if (
  16. bcrypt.encode(s"$prefix$passwordHash$suffix") ==
  17. sqlStore.connect.map(_.getPassword)
  18. ) {
  19. UUID.getNew
  20. } else {
  21. new PasswordMismatch
  22. }
  23. }
  24. }
  25. }
  26. }