                  (dot 3)
                  (dot 0))))))
 
+(defn keylistener [app owner]
+  (reify
+    om/IDidMount
+    (did-mount [_]
+      (let [f (fn [e] (when (= "Shift" (.-key e)) (om/update! app :should-stop (= "keydown" (.-type e)))))]
+        (.addEventListener js/document "keydown" f)
+        (.addEventListener js/document "keyup" f)))
+
+    om/IRender
+    (render [_] (dom/div nil))))
+
 (om/root
  (fn [app owner]
    (reify


(defn millis [] (.now js/performance))

(defn click [_ owner]
  (reify
    om/IInitState
    (init-state [_] {:previous-click nil})

               (dom/h1 nil "metronome")
               (om/build clock (:bpm app) {:init-state {:sound-channel sound-channel :click-channel click-channel}})
               (om/build sound (:meter app) {:init-state {:sound-channel sound-channel}})
               (om/build click app {:init-state {:click-channel click-channel}})
               (om/build dots (:meter app))
               (om/build keylistener app))
      )))
 app-state
 {:target (. js/document (getElementById "app"))})
