I think I can use a prefer-method but haven't gotten to it yet 😅
I still don't understand why my https://github.com/djblue/portal/blob/master/src/portal/runtime/jvm/client.clj#L76-L77 method isn't preferred :thinking_face:, any ideas?
The main feature this supports is deref-ing the result of open to get the current selected value back into your runtime repl environment
yeah, I like that, also being able to swap/reset is nice
I'm starting to add this to my user
/ cljs.user
namespaces
(def portal-instance nil)
(defn portal
"Open a Portal window and register a tap handler for it. The result can be
treated like an atom."
[]
(let [p (portal/open portal-instance)]
(set! portal-instance p)
(add-tap #'portal/submit)
p))
the clj version
(def portal-instance (atom nil))
(defn portal
"Open a Portal window and register a tap handler for it. The result can be
treated like an atom."
[]
(let [p ((jit portal.api/open) @portal-instance)]
(reset! portal-instance p)
(add-tap (jit portal.api/submit))
p))
(using the [jit macro](https://lambdaisland.com/blog/2019-12-11-advent-of-parens-11-integrant-in-practice))so I can start with (user/portal)
, or get results back out with @(user/portal)