summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.nrepl-port2
-rw-r--r--portal.clj25
2 files changed, 13 insertions, 14 deletions
diff --git a/.nrepl-port b/.nrepl-port
index 0b9fe47..67de041 100644
--- a/.nrepl-port
+++ b/.nrepl-port
@@ -1 +1 @@
-53291 \ No newline at end of file
+57858 \ No newline at end of file
diff --git a/portal.clj b/portal.clj
index ce05eb8..2e20bdf 100644
--- a/portal.clj
+++ b/portal.clj
@@ -48,19 +48,18 @@
(def >portal-ui
(m/ap
+ (let [ui (m/? (m/via m/blk ((requiring-resolve 'portal.api/open))))]
+ (m/amb= ui
+ (try (m/? m/never)
+ (finally
+ ;; Were this blocking, I would put this on m/blk
+ ((requiring-resolve 'portal.api/close) ui)
+ (m/amb)))))))
+
+(def >portal-ui-toggle
+ (m/ap
(when (m/?< >show-portal?)
- (try
- (m/?<
- (m/observe
- (fn [cb]
- ((m/via m/blk ((requiring-resolve 'portal.api/open))) {} {})
- (cb :open)
- (fn []
- ((m/via m/blk
- ((requiring-resolve 'portal.api/close))
- ((requiring-resolve 'portal.api/clear))) {} {})))))
- (catch missionary.Cancelled _
- (m/amb)))
+ (m/?< >portal-ui)
(m/amb))))
(defn cap
@@ -80,5 +79,5 @@
(def >portal-main
"Main entrypoint."
- (m/ap (m/amb= (do (m/?< >portal-ui)
+ (m/ap (m/amb= (do (m/?< >portal-ui-toggle)
(m/amb)))))