                                       :strokeOpacity 1.0
                                       :strokeWeight 2}))))
 
-(defn r-map-object [class opts gmap]
-  (let [obj (class. (clj->js @opts))]
-    (r/create-class
-     {:component-did-mount (fn [this]
-                             (let [[_ _ opts gmap] (r/argv this)
-                                   m-opts (merge @opts {:map gmap})]
-                               (.setOptions obj (clj->js m-opts))))
-      :component-did-update (fn [this]
-                              (let [[_ _ opts gmap] (r/argv this)
-                                    m-opts (merge @opts {:map gmap})]
-                                (.setOptions obj (clj->js m-opts))))
-      :component-will-unmount (fn [this]
-                                (.setMap obj nil))
-      :component-function (fn [class opts gmap]
-                            [:noscript])})))
+(defn map-object [data owner]
+  (reify
+    om/IRender
+    (render [_]
+      [:noscript])
+    om/IInitState
+    (init-state [_]
+      (let [{:keys [class opts]} data]
+        {:object (class. (clj->js opts))}))
+    om/IDidMount
+    (did-mount [_]
+      (let [{:keys [opts gmap]} data
+            object (om/get-state owner :object)]
+        (->> {:map gmap}
+             (merge opts)
+             (clj->js)
+             (.setOptions object))))
+    om/IDidUpdate
+    (did-update [_ _ _]
+      (let [{:keys [opts gmap]} data
+            object (om/get-state owner :object)]
+        (->> {:map gmap}
+             (merge opts)
+             (clj->js)
+             (.setOptions object))))
+    om/IWillUnmount
+    (will-unmount [_]
+      (let [object (om/get-state owner :object)]
+        (.setMap object nil)))))
 
-(defn r-marker [opts gmap]
-  (let [marker (Maps.Marker. (clj->js @opts))]
-    (r/create-class
-     {:component-did-mount (fn [this]
-                             (let [[_ opts gmap] (r/argv this)
-                                   m-opts (merge @opts {:map gmap})]
-                               (.setOptions marker (clj->js m-opts))))
-      :component-did-update (fn [this]
-                              (let [[_ opts gmap] (r/argv this)
-                                    m-opts (merge @opts {:map gmap})]
-                                (.setOptions marker (clj->js m-opts))))
-      :component-will-unmount (fn [this]
-                                (.setMap marker nil))
-      :component-function (fn [opts gmap]
-                            [:noscript])})))
-
-(defn r-polyline [opts gmap]
-  (let [polyline (Maps.Polyline. (clj->js @opts))]
-    (r/create-class
-     {:component-function (fn [opts gmap]
-                            [:noscript])})))
+(defn e-map [data owner]
+  (reify
+    om/IDidMount
+    (did-mount [_]
+      (let [{:keys [opts]} data
+            node (om/get-node owner)]
+        (om/set-state! owner :gmap (Maps.Map. node (clj->js opts)))))
+    om/IRenderState
+    (render-state [_ state]
+      (html [:div {:id :map-canvas}]))))
 
 (defn map-listen
   "Return a channel listening on events of type in obj."

      :component-function (fn [state]
                            [:div {:id :map-canvas
                                   :style {:height "100%"
                                           :margin 0
                                           :padding 0}}
                             (doall
                              (for [{id :route/id
                                     :as route-data} (:routes @state)]

(ns gtfve.maps
  (:require-macros [cljs.core.async.macros :refer [go go-loop]])
  (:require [om.core :as om]
            [sablono.core :as html :refer-macros [html]]
            [cljs.core.async :as async :refer [put! chan <! close!]]
            [goog.events :as events]
            [goog.history.EventType :as EventType]
