Last active
August 29, 2015 14:00
-
-
Save attentive/b3cb3041c3f837e83f98 to your computer and use it in GitHub Desktop.
LeafletJS Hello World in Om and ClojureScript
This file contains 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 leaflet-helloworld | |
(:require [om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true])) | |
(defn map-view [_ owner] | |
(reify | |
om/IRender | |
(render [_] | |
(dom/div #js {:id "the-map"} nil)) | |
om/IDidMount | |
(did-mount [_] | |
(let [osm-url "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" | |
osm-attrib "Map data © OpenStreetMap contributors"] | |
(doto (js/L.Map. "the-map") | |
(.setView (js/L.LatLng. 0 0) 1) | |
(.addLayer (js/L.TileLayer. osm-url | |
#js {:minZoom 1, :maxZoom 19, | |
:attribution osm-attrib}))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have been looking at this to get leafletJS to work, I added the component and bound it to the om/root... however, besides creating the the-map node it doesn't do anything for me.... perhaps you can post the full source for the example?