ClojureScript One is built on top of Ring, which provides nice middleware 
for handling cookies [1].

You may want to search for "wrap-" on the web page of One's marginalia 
documentation to see where you could add this middleware [2].

[1] https://github.com/mmcgrana/ring/wiki/Cookies
[2] http://clojurescriptone.com/documentation.html

But all of this is server-side, and if you need to persist state of which 
the server can't know about, then you need to set the cookies on the client 
side. There, accessing cookies can be done by calling standard 
cookie-handling javascript functions [3] (using ClojureScript's interop to 
javascript). Or you may prefer to use the Cookies class that comes with the 
Google Closure Library that's part of ClojureScript [4], which I would 
advise to do if you need to manage cookies client-side.

[3] http://www.w3schools.com/js/js_cookies.asp
[4] http://closure-library.googlecode.com/svn/docs/class_goog_net_Cookies.html

As for how to call either of those things from ClojureScript, I suggest 
looking at One's source code for lots of examples. (One doesn't use cookies 
at all but you'll see lots of calls of js stuff, and lots of usages of 
Closure Library stuff.)

On Saturday, January 21, 2012 9:37:26 PM UTC-5, Folcon wrote:
>
> Actually thinking about this what you are saying seems to be correct, I 
> just realised that the atom is stored on the client, not the server. Is 
> there any cookie functionality I can access from clojurescript?
>
> Regards,
> Folcon
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to