I started researching core.async after reading your post.  I'm curious how
it's implemented in single-threaded javascript.


--
Jonathon McKitrick


On Mon, Aug 4, 2014 at 12:55 PM, Harsha <[email protected]> wrote:

> > I'm not familiar with that approach of using core.async.  I'm simply
> using callbacks to set the atom each select depends on.  Is there a better
> way with core.async?
>
> I'm afraid I can't really suggest much without concrete code.
> I may be giving a rather generic solution.
>
> Basically core.async can be used to decouple everything.
>
> (def main-chan (chan))
>
> (def A
> ....
>  (>! main-chain {:changed :A :data ["something"]})
> ...)
>
> (def B
> ...
>  (go (loop []
>    (let [info (<! main-chan)]
>      (cond (= (:changed info) :A)
>         ;; A has changed.
>          (update B-picklist? (:data info)))
>    ....
>    (recur))
> ...)
>
>
> A is dependant on B is same as B wants to know when A changes.
> Whenever A changes do  (>! main-chain {:changed :A :data ["something"]})
>
> This is a bit like using a message bus, but a very efficient one.
>
> Hope that helps.
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "ClojureScript" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojurescript/p2aLNuVtjLU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to