This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-08
Channels
- # adventofcode (60)
- # announcements (3)
- # babashka (31)
- # beginners (5)
- # boot (1)
- # calva (13)
- # cider (9)
- # clj-kondo (1)
- # clojure (135)
- # clojure-italy (18)
- # clojure-nl (18)
- # clojure-spec (21)
- # clojure-uk (11)
- # clojuredesign-podcast (1)
- # clojurescript (47)
- # core-async (14)
- # emacs (7)
- # euroclojure (4)
- # fulcro (3)
- # graalvm (19)
- # off-topic (22)
- # reagent (29)
- # shadow-cljs (25)
- # vim (3)
Yes, it does indeed. But when take
finishes it returns nil, which is the value the handler return, therefore my Lambda returns nil. (handler (take! ch #(callback %)))
returns nil, the callback result is lost in the process.
@dennisa haven't tried it myself, but i think you can return a promise as the result of your lambda (see "async functions" https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html ), and then you can resolve or reject that promise in your core.async take!
callback
Yes, you right, you can return a promise to the handler, eg as a result of a http request. But how can I read from channel and make it to return a promise outside of the channel chain in cljs? Promise will be the value in this case, while a go block will just return a channel
_The third argument, callback, is a function that you can call in non-async functions to send a response. The callback function takes two arguments: an Error and a response. The response object must be compatible with JSON.stringify. For async functions, you return a response, error, or promise to the runtime instead of using callback._
I'm having some trouble with this design. I'm writing a CLJS app and trying to mimic something like re-frame or CycleJS. I'm flexible on the design, just need some direction to satisfy this problem. Thanks!
I'm pretty confident I know why its not working, just seeing if there's an established idiomatic approach to this
Events needs to be a mult and each if your pubs needs to tap it, otherwise each event only goes to a single pub
Thanks, I'll try that!
I think that worked perfectly? Great!