Fork me on GitHub
#portal
<
2023-09-30
>
Casey12:09:14

I'm following the https://cljdoc.org/d/djblue/portal/0.48.0/doc/guides/shadow-cljs.. I've got the web version working, but I would also like to try the remote version. How do I open the remote portal window ? That doesn't seem to be covered. When using portal.api in clj, I can do portal.api/open to open the frame, but that doesn't seem to exist in the portal.shadow.remote ns

djblue19:09:22

Ohh, sorry for the confusion. When using portal.shadow.remote, values will be submitted to the jvm version of portal via the https://cljdoc.org/d/djblue/portal/0.48.0/doc/remote-api. If you do (add-tap portal.api/submit) (portal.api/open) values should appear in that instance of portal.

Casey06:10:16

Could you explain how to set it up? I've followed the first link (put all that code in a cljs file), and I can use portal.web/p to open a submit values. But when my app crashes for some reason (doesn't happen often but it does), portal goes with it).

Casey06:10:16

Ok, I've created a clj namespace and added:

(ns portal-remote
  (:require [portal.api :as p]))

  (p/open {:theme :portal.colors/gruvbox
           :port 5678})
Then in the cljs namespace used (partial p/submit {:port 5678}) as the submit function.. and I think it's working..

Casey06:10:22

Yea seems to work well! No need to use the portal.shadow.remote it seems?

djblue00:10:29

The approach you settled on will work 👍 The main thing https://github.com/djblue/portal/blob/master/src/portal/shadow/remote.clj#L11C9-L13 does is orchestrate the port between your cljs client and the portal server so you don't have to manually do it.

Casey05:10:39

Thanks. Is it possible to get cljs forms I evaluate in my editor to appear in the remote portal? (Without using tap>) I use this in clj and is super handy.

djblue06:10:27

The https://github.com/djblue/portal/blob/master/src/portal/nrepl.clj#L80 middleware should be capture / tap> this info automatically for you. https://cljdoc.org/d/djblue/portal/0.48.0/doc/guides/nrepl#shadow-cljs is how you setup the middleware with shadow-cljs.