title: How can I pass edn to clojurescript from clojure without making ajax request (i.e. via hiccup-generated page)
body: <p>I'm developing RIA with clojure and clojurescript. Backend uses hiccup to generate a resulting html, like</p>
  
  <pre><code>(html5 
  [:head 
    (include-js "/js/my-cljs-generated.js")]
  [:body ... ])
  </code></pre>
  
  <p>How can I pass edn(hashmap, vector, etc.) to clojurescript within the resulting html, i.e. without doing ajax call? </p>
  
  <p>I would like to make hiccup do something like this: </p>
  
  <pre><code>(include-edn 
     "var_name" {:foo :bar}) ; or any other clojure data
  </code></pre>
  
  <p>and to be able to access the passed edn from cljs somehow(e.g. by name).</p>
  
  <p>Currently my implementation is a bit hacky and stores edn in a global js var </p>
  
  <pre><code>(hiccup/javascript-tag (str "var edn = \""
                         (pr-str my-clojure-data) "\";"))        
  </code></pre>
  
  <p>and on cljs side does smth like</p>
  
  <pre><code>(jayq/document-ready 
    (fn []
      (if-let [edn (.-edn js/window)]
        (do-something-with (cljs.reader/read-string edn))
      )
      ...
  )
  </code></pre>
  
  <p>Maybe there is more idiomatic way of achieving this? </p>