scittle

ray 2022-12-17T11:02:32.768599Z

You can also use promesa with scittle

Richie 2022-12-19T15:31:03.339349Z

Ah, cool! Thanks!

borkdude 2022-12-19T15:31:25.238759Z

Promesa rocks metal

❤️ 1
ray 2022-12-18T22:28:08.076799Z

Sure, that would be weird 😉

niwinz 2022-12-19T06:44:49.522929Z

yep, is called, (p/deferred) (sorry for late response)

👍 1
niwinz 2022-12-19T06:46:19.508069Z

in response to: "Does promesa support that pattern somehow?"

(let [promise (d/deferred)]
  (p/resolve! promise 10)
  promise)

👍 1
ray 2022-12-17T11:03:55.872229Z

See https://github.com/aoc-rmc/aoc22

borkdude 2022-12-17T11:10:28.272699Z

^ @rgkirch

borkdude 2022-12-17T11:16:02.083319Z

@raymcdermott 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 body

borkdude 2022-12-17T11:16:09.301129Z

Does promesa support that pattern somehow?

borkdude 2022-12-17T11:16:14.029059Z

cc @niwinz

ray 2022-12-17T12:41:31.455869Z

I use a reagent atom to manage state which is updated by fetch. Then the ui reacts to the atom update.

Richie 2022-12-17T20:01:50.947489Z

@borkdude I didn’t think about capturing resolve like that. I think that’s what I wanted.

Richie 2022-12-17T20:02:00.195629Z

👍 1
Richie 2022-12-17T20:03:43.613779Z

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