     (will-mount [_]
        (let [clickchan (om/get-state owner :clickchan)]
         (go (loop []
-          (let [e (<! clickchan)]
-            (when (= e :new-doc) (create-new-document app owner))
-            (when (= e :export-doc) (export-image) (dump-image))
-            (when (= e :export-history-animation) (export-history-animation))
+          (let [e (<! clickchan)
+                command (:command e)
+                origin-owner (:owner e)]
+            (when (= command :new-doc) (create-new-document app owner))
+            (when (= command :export-doc) (export-image) (dump-image))
+            (when (= command :export-history-animation) (export-history-animation origin-owner))
           (recur))))))
 
     om/IRenderState


(defn menu-entry-component [entry owner]
  (reify
    om/IRenderState
      (render-state [this {:keys [clickchan]}]
        (omdom/div
          #js {:className "main-menu-item"
               :onClick (fn [e] (put! clickchan (:command @entry)))}
          (omdom/i #js {:className (:icon entry)})
          (:text entry)))))


(defn menu-component [app owner]

            [goya.canvasdrawing :as canvasdrawing]
            [cljs.core.async :refer [put! chan <! alts!]]))


(defn show-progress [progress owner]
  (let [p (.round js/Math (* progress 100))]
    (om/set-state! owner :progress p)))

(defn dump-image []
  (.log js/console (str (get-in @app/app-state [:main-app :image-data]))))
