                (om/build button {:text "Load state"
                                  :click-chan load-state-ch})))))
 
-(defn audio-view [_ owner]
+(defn audio-view [cursor owner]
   (reify
     om/IInitState
     (init-state [_]

               (om/build hive-view {:cursor (:hive cursor)
                                    :save-state-ch (:save-state-ch state)
                                    :load-state-ch (:load-state-ch state)})
               (om/build audio-view {})
               (om/build grid-view {:id "root" :beat-cursors (:beat-cursors cursor)} {:state state})
               (om/build console-view (:console cursor))))))


                      (map (partial dom/li nil) cursor))))))

(defn button [{:keys [text click-chan]} owner]
  (let [render (fn [] (let [node (om/get-node owner)
                            b (Button. text (.getInstance FlatButtonRenderer))]
                        (om/update-state! owner #(merge % {:button b}))
                        (.render b node)
                        (gevents/listen b Component.EventType.ACTION
                                        #(go (>! click-chan true)))))]
  (reify
    om/IInitState
    (init-state [_] {})
    om/IRenderState
    (render-state [_ state] (dom/div nil nil))
    om/IDidMount
    (did-mount [_]
      (render))
    om/IWillUpdate
    (will-update [_ next _]
      (let [b (:button (om/get-state owner))
            prev (om/get-props owner)]
        (when-not (= next prev)
          (.dispose b))))
    om/IDidUpdate
    (did-update [_ prev _]
      (when-not (= text (:text prev))
        (render))))))

(defn hive-view [{:keys [cursor save-state-ch load-state-ch]}]
  (reify
