On Thursday, August 21, 2014 9:16:01 AM UTC-4, [email protected] wrote:
> Hi all, I'm sure I could figure this out, but I'm feeling lazy: Is it 
> possible to update a clojurescript atom from javascript? If so, what's the 
> syntax?
> 
> Thanks, 
> Dave

Probably not very useful for much, but here's some basic syntax to update an 
atom from javascript just in case anyone is interested/for posterity: 

//create the atom in cljs.user> (def (atom {:foo "bar"}))
//then it's possible change the value from javascript like this: 
var new_val = 
cljs.core.PersistentArrayMap.fromArray([cljs.core.keyword("foo"),"baz"]);
cljs.core.swap_BANG_(cljs.user.app, function (){return new_val});
//cljs.user> @app
//  => {:foo "baz"}

-- 
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