Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Created February 2, 2014 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwaldron/8762929 to your computer and use it in GitHub Desktop.
Save rwaldron/8762929 to your computer and use it in GitHub Desktop.
(ns mc-map.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(enable-console-print!)
(def app-state (atom {:mapOptions #js {:center (google.maps.LatLng. -34.397 150.644)
:zoom 8}}))
(defn map-view [app owner]
(reify
om/IRender
(render [this]
;; render has to return a component:
(dom/div nil))
om/IDidMount
(did-mount [this node]
;; node refers to the component I returned in render,
;; but I ignore it and attach the Map to its parentNode "map-canvas":
(google.maps.Map. (.-parentNode node) (:mapOptions app)))))
(om/root
app-state
map-view
(. js/document (getElementById "map-canvas")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment