This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-09
Channels
- # beginners (91)
- # boot (5)
- # cider (30)
- # clara (16)
- # cljsjs (3)
- # cljsrn (6)
- # clojure (84)
- # clojure-dev (4)
- # clojure-dusseldorf (1)
- # clojure-italy (15)
- # clojure-nl (2)
- # clojure-spec (5)
- # clojure-uk (120)
- # clojurescript (54)
- # core-async (25)
- # core-matrix (1)
- # css (2)
- # cursive (20)
- # datomic (28)
- # editors (11)
- # emacs (6)
- # figwheel (4)
- # figwheel-main (28)
- # fulcro (36)
- # graphql (7)
- # hyperfiddle (2)
- # jobs (6)
- # jobs-discuss (10)
- # lambdaisland (1)
- # lumo (3)
- # nrepl (20)
- # off-topic (24)
- # pedestal (2)
- # protorepl (3)
- # reagent (3)
- # reitit (2)
- # remote-jobs (1)
- # ring-swagger (26)
- # rum (1)
- # shadow-cljs (247)
- # spacemacs (29)
- # tools-deps (12)
- # vim (15)
quick question, if I get a promise returned from a javascript library, will it be handled gracefully within a core.async
chan
?
@loganpowell not directly, but this example seems OK http://clojurescriptmadeeasy.com/blog/promises-with-core-async.html
This seems to me to be some ways to mimic promise.all rather than convert a promise into something that can be consumed by a chan
am I mistaken?
core.async AFAIK knows nothing about javascript promises directly
I'll double check
yeah, sorry, it wasn't what I thought it was
no worries
Maybe something like this?
that won't work though, will it, because it's async
I found this: https://clojurians-log.clojureverse.org/clojurescript/2017-03-07 potential gem. Will this work?
sorry, let me just give that a shot
that will "work" but because you aren't using the callback version of put! you lose any communication of back pressure between promise and chan land
ah, so it should be used sparingly... would it be ok for a chan with a buffer of 1 and then closed?
just using the chan as a handoff point
ok, thank you sir
or would the coordination between the chan and other functions be miscommunicated
the cljs js-library interop story has some dragons in it
I think the hipster thing in javascript land (circa 2015) was Promises everywhere
nowadays, they're looking at async/await as the new hotness. They don't know what they're missing in core.async over there