This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-17
Channels
- # adventofcode (33)
- # announcements (1)
- # beginners (32)
- # calva (12)
- # cider (1)
- # clojure (73)
- # clojure-belgium (1)
- # clojure-europe (20)
- # clojure-norway (3)
- # datomic (3)
- # emacs (2)
- # fulcro (18)
- # graphql (11)
- # honeysql (1)
- # juxt (1)
- # lsp (10)
- # membrane (13)
- # reitit (1)
- # releases (5)
- # scittle (15)
- # spacemacs (1)
- # squint (36)
- # testing (1)
- # tools-deps (20)
- # xtdb (5)
@U04V5V0V4 His question was about this pattern:
(let [[promise resolve reject] (js/Promise. (fn [resolve reject] ...))]
(resolve 10)
;; promise is resolved now)
So being able to resolve the promise from outside of the promise. I've done this in the past by closing over an atom and then storing the resolve function in the atom so you can use it outside of the promise function bodyI use a reagent atom to manage state which is updated by fetch. Then the ui reacts to the atom update.
@U04V15CAJ I didn’t think about capturing resolve
like that. I think that’s what I wanted.
@U04V5V0V4 I think what’s different is that you make a new fetch each time but I didn’t want to make a new websocket each time.