This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-26
Channels
- # aatree (6)
- # admin-announcements (2)
- # aws (1)
- # beginners (46)
- # boot (341)
- # braid-chat (3)
- # cider (20)
- # clara (1)
- # cljs-dev (3)
- # cljsjs (7)
- # cljsrn (73)
- # clojure (63)
- # clojure-art (4)
- # clojure-dev (3)
- # clojure-russia (83)
- # clojurescript (77)
- # core-async (12)
- # core-matrix (2)
- # cursive (9)
- # data-science (1)
- # datomic (14)
- # dirac (3)
- # emacs (9)
- # hoplon (3)
- # immutant (8)
- # ldnclj (80)
- # luminus (13)
- # mount (7)
- # off-topic (4)
- # om (288)
- # onyx (20)
- # overtone (5)
- # pedestal (10)
- # perun (3)
- # proton (103)
- # quil (1)
- # re-frame (3)
- # reagent (13)
- # ring-swagger (7)
- # yada (43)
Hi. Is it possible to synchronize AJAX request with core.async
somehow (taking into account <!!
doesn't exist in CLJS)?
@andrewboltachev: what do you mean by synchronize? you can use a promise chan and put the XMLHttpRequest result to it, and work with that in a go
block
I mean to have function like (defn return-data-from-resource [url] )
which returns data when it arrives
@andrewboltachev: not directly in cljs, but you can make it return a (promise) chan that you can process synchronously from within a go
block
I just remember I've seen sth like that
May be not, of course
Well, I'll try to think up a solution
@andrewboltachev: you can use the synchronous xmlhttprequest api, but can't recommend that. otherwise, there's no way to do things that couldn't be done in javascript, go
just rewrites your code so that you can reason about it like it's synchronous
yep I understand. in fact, in my task I would be invoking callback anyway (but I need to ditch few items in a row). I believe I might find a solution with core.async
. Thanks @sander