portal

Casey 2023-09-30T12:38:14.888839Z

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

djblue 2023-09-30T19:43:22.120569Z

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.

Casey 2023-10-01T06:26:16.197839Z

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).

Casey 2023-10-01T06:36:16.158519Z

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..

Casey 2023-10-01T06:51:22.150609Z

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

djblue 2023-10-02T00:15:29.487179Z

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.

Casey 2023-10-02T05:20:39.612309Z

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.

djblue 2023-10-02T06:08:27.068279Z

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.