{"action":"opened","issue":{"url":"https://api.github.com/repos/tenderowls/moorka/issues/89","repository_url":"https://api.github.com/repos/tenderowls/moorka","labels_url":"https://api.github.com/repos/tenderowls/moorka/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/tenderowls/moorka/issues/89/comments","events_url":"https://api.github.com/repos/tenderowls/moorka/issues/89/events","html_url":"https://github.com/tenderowls/moorka/issues/89","id":161665072,"number":89,"title":"FSM.once doesn't work","user":{"login":"vsuharnikov","id":2654820,"avatar_url":"https://avatars.githubusercontent.com/u/2654820?v=3","gravatar_id":"","url":"https://api.github.com/users/vsuharnikov","html_url":"https://github.com/vsuharnikov","followers_url":"https://api.github.com/users/vsuharnikov/followers","following_url":"https://api.github.com/users/vsuharnikov/following{/other_user}","gists_url":"https://api.github.com/users/vsuharnikov/gists{/gist_id}","starred_url":"https://api.github.com/users/vsuharnikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsuharnikov/subscriptions","organizations_url":"https://api.github.com/users/vsuharnikov/orgs","repos_url":"https://api.github.com/users/vsuharnikov/repos","events_url":"https://api.github.com/users/vsuharnikov/events{/privacy}","received_events_url":"https://api.github.com/users/vsuharnikov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-22T12:09:37Z","updated_at":"2016-06-22T12:09:37Z","closed_at":null,"body":"Example:\r\n\r\n```scala\r\nimport moorka._\r\n\r\nimport scala.concurrent._\r\nimport scala.concurrent.duration._\r\nimport scala.concurrent.ExecutionContext.Implicits.global\r\nimport java.util.{Timer, TimerTask}\r\n\r\nimport scala.concurrent.Promise\r\n\r\nval timer = new Timer(true)\r\n\r\n// === Essence\r\ndef fsm = FSM(0) {\r\n  case 5 ⇒ Dummy\r\n  case x ⇒ after(1 second).toRx.map { _ ⇒\r\n    println(s\"x: $x\")\r\n    x + 1\r\n  }\r\n}\r\n\r\n// Will not print anything\r\nfsm once println\r\n\r\n// Will print \"0\"\r\nfsm flatMap { x ⇒\r\n  println(x)\r\n  Killer\r\n}\r\n\r\n// === /Essence\r\n\r\ndef after(timeout: FiniteDuration): Future[Unit] = {\r\n  val p = Promise[Unit]()\r\n  val task = new TimerTask {\r\n    override def run(): Unit = {\r\n      p.success(())\r\n    }\r\n  }\r\n\r\n  timer.schedule(task, timeout.toMillis)\r\n\r\n  p.future\r\n}\r\n```\r\n\r\n* Moorka 0.7.1\r\n* Scala.JS 0.6.10"}}
{"actor":{"display_login":"vsuharnikov"}}