Skip to content

Instantly share code, notes, and snippets.

@jmgimeno
Created February 2, 2014 08:15
Show Gist options
  • Select an option

  • Save jmgimeno/8764629 to your computer and use it in GitHub Desktop.

Select an option

Save jmgimeno/8764629 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