> > <script type="text/javascript"> > $(function() {my_cljs_ns.initialize('data');}); > </script> > > Today I coded up a method. Currently I'm creating divs of a class that is invisible. Then I just use some node searcher to grab the content then call read-string on it. Seems easier to do then inserting the javascript function call as you are doing, but my method involves more computation (probably very negligible). It's simple and it works.
(ns foo (:require [goog......]) (:require-macros [enfocus.macros :as em])) (defn node-raw-text [selector] (let [store (atom)] (em/at js/document selector (fn [node] (reset! store (goog.dom/getRawTextContent (first node))))) @store)) ;; then later you can call something like so (reader/read-string (node-raw-text [:div#default-cljs-data])) > Why are you trying to avoid parsing the clojurescript client-side? Are > you working with a very large data structure? Dynamically compiling the > form to javascript on the server side is going to be very expensive, > although I guess if it's very cache-friendly it might work out well. > > Be aware that if you're using the compiled clojurescript approach, and are > using advanced optimizations, that you'll need to make careful use of > :export and possibly even :externs to make the pre-compiled and > dynamically-compiled javascript work together. > > Basically, I want to see what's possible. If someone's done the research on how to do it this way, I'd like to see it. There's a different trade-off being made with each method. -- 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