     (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]

    (.click download-link)))


(defn download-history-animation [blob owner]
  (let [download-link (. js/document (getElementById "image-download-link"))]
    (om/set-state! owner :is-processing false)
    (set! (.-href download-link) (.createObjectURL js/URL blob))
    (.click download-link)))

(defn export-history-animation [owner]
  (let [render-canvas (. js/document (createElement "canvas"))
        width (get-in @app/app-state [:main-app :canvas-width])
        height (get-in @app/app-state [:main-app :canvas-height])
