This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-13
Channels
- # announcements (1)
- # babashka (2)
- # biff (10)
- # cider (11)
- # clara (17)
- # clerk (10)
- # clojure (21)
- # clojure-berlin (4)
- # clojure-brasil (1)
- # clojure-europe (32)
- # clojure-nl (1)
- # clojure-norway (18)
- # clojure-uk (10)
- # cursive (2)
- # data-science (11)
- # datomic (10)
- # emacs (8)
- # events (7)
- # fulcro (29)
- # gratitude (2)
- # honeysql (21)
- # hyperfiddle (7)
- # lsp (2)
- # malli (4)
- # polylith (4)
- # reitit (8)
- # releases (1)
- # shadow-cljs (15)
- # squint (3)
- # xtdb (5)
(This is very likely a common question but I couldn't find any useful ref outside of https://clojurians.slack.com/archives/C7Q9GSHFV/p1688154851988839 - feel free to just tell me I'm stupid and missed prior art 🙂)
I too am messing with Codemirror and would like to leverage (e/server ...)
to get completions from the server. It's a very similar situation to dom listeners, except that I care about the return type of my thunks and I'd like them to block the dom (cm) callback waiting for the result. Is there an easy way to boot a temporary electric runtime for just the lifetime of a plain JS callback? I've tried various things, including just (m/? (new server-info data))
and (new server-info data)
(where server-info
is an e/fn
and the callsite is just a plain js fn) but probably obviously this doesn't work.
I also tried a couple variations of code similar to ui4/button but didn’t figure out how to return the result in a blocking way
can you post pseudo code for this so we can understand the goal
Broadly, it’s
(cc/defn get-completions [^js context]
;; need something that does this
(let [server-data (js->clj context]
(clj->js (e/server (server-get-completions server-data)))))
I would look for an async API and then you can use an atom or missionary port to send values from electric into the clojure callback
where would electric and missionary fit in the following graph? taken from https://webperso.info.ucl.ac.be/~pvr/VanRoyChapter.pdf