Skip to content

Instantly share code, notes, and snippets.

@rwaldron

rwaldron/core.cljs

Created Feb 2, 2014
Embed
What would you like to do?
(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
You can’t perform that action at this time.