Created
February 2, 2014 08:15
-
-
Save jmgimeno/8764629 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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