[ClojureScript] Re: Bridging core.async / callbacks

2019-05-05 Thread Rangel Spasov
"Write a function that does not return until some channel event occurs." Is this а pure function or it has side effects (network call, etc) ? If it's a pure function you can look into core.async transducers. You can achieve the effect of not returning immediately by putting your logic

[ClojureScript] Re: Bridging core.async / callbacks

2019-05-04 Thread Tom Locke
I don't think this addresses the issue. I'll try to state the problem more simply: Write a function that does not return until some channel event occurs. (The difficulty being that go, put! and take! all return immediately) I would argue the ability to do so is: - fundamentally

[ClojureScript] Re: Bridging core.async / callbacks

2019-05-03 Thread Rangel Spasov
Here's one idea, basically put "channel on a channel" idea: (defonce main-c (chan 1)) (defn start-main-channel-loop [] ;put channels on the channel in the order that they need to execute (go (loop [] (let [c (! this first (>! callback-c [:second {}]) ;wait 3