Hi Sam,

this is how I use Google Maps with Clojurescript. In the html
page I load Google's Loader library, the Google Closure base.js
file and the deps.js file which is the one cljsc spit out.

(defhtml javascripts []
  (html
   (include-js (str "https://www.google.com/jsapi?key="; (google-api-key)))
   (if (development?) (include-js "/javascripts/goog/base.js"))
   (include-js "/javascripts/deps.js")
   (if (development?) (javascript-tag 
"goog.require('burningswell.application');"))))

After those have been loaded I require my application namespace,
which calls the start fn at the end of the file. Something like
this:

(defn ^:export start []
  (. js/google (load "maps" "3.6", (h/clj->js {:other_params 
"sensor=false"})))
  (. js/google
     (setOnLoadCallback
      (fn []
         (set! *map* (init-map (goog.dom/getElement "map")))))))

(start)

I compile Clojurescript files with this command:

cljsc src/cljs '{:externs 
["closure-compiler/contrib/externs/maps/google_maps_api_v3_6.js" 
"closure-compiler/contrib/externs/google_loader_api.js"] :output-dir 
"resources/public/javascripts"}' > resources/public/javascripts/deps.js

The important stuff is the externs option when using advanced
mode. This worked for me quiet well so far. I used this way
because I want to access the user's client location via Google's
loader API.

A simpler way is to include only the Google Maps javascript file
and it's extern file. That used to work also fine ...

Hope this helps, Roman.

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