 
 (enable-console-print!)
 
-(def debug false)
+(def debug true)
 
 (def app-model
-  (atom {:current-slide 4
+  (atom {:current-slide 1
          :slides
          [{:title "core.async"
            }

    om/IRender
    (render [_]
      (html
       (if (:visible data)
         [:div {:style {:display (if (:visible data) :block :none)}}
          [:div
           #_(when (:background data)
               {:style {:background "url(/static/cspdiag.jpg)"}})

           [:h2 {:style {:color "green"}} (:title data)]
           [:p (:text data)]
           (when-let [code (:code data)]
             [:pre code]
             )
           (when (:custom data)
             [:svg {:version "1.1" :width 600 :height 600}
              [:text {:x 200 :y 100} "(>! (chan))"]
              [:rect {:x 0 :y 0 :width 200 :height 200 :style {:fill "blue"}}]
              [:rect {:x 50 :y 20 :width 100 :height 300 :style {:fill "red"}}]]
             )
           ]]

         [:div {:style {:display :none}}]
         )))))

(defn slides [app owner]
  (reify

      (goog.events.listen
       js/document "keydown"
       (fn [e]
         (cond
          (or (= (.-keyCode e) 37)
              (= (.-keyCode e) kc/PAGE_UP))
          (when (pos? (:current-slide @app))
            (om/transact! app :current-slide dec))
          (or (= (.-keyCode e) 39)
              (= (.-keyCode e) kc/PAGE_DOWN))
          (when (get-in @app [:slides (inc (:current-slide @app))])
            (om/transact! app :current-slide inc)))

         (navigate-to-slide! app (:current-slide @app) (count (:slides @app)))))

      ;; Navigate to initial slide
      (navigate-to-slide! app (:current-slide app) (count (:slides app)))
      )

    om/IRender
    (render [_]
      (html
