 
 (defn menu-entry-component [entry owner]
   (reify
+    om/IInitState
+      (init-state [_]
+        {:is-processing false
+         :progress 0})
+
     om/IRenderState
       (render-state [this {:keys [clickchan]}]
         (omdom/div
           #js {:className "main-menu-item"
-               :onClick (fn [e] (put! clickchan (:command @entry)))}
+               :onClick (fn [e] (put! clickchan {:command (:command @entry)
+                                                 :owner owner}))}
           (omdom/i #js {:className (:icon entry)})
-          (:text entry)))))
+          (if
+            (om/get-state owner :is-processing)
+            (str "Working... "(om/get-state owner :progress) "%")
+            (:text entry))))))
 
 
 (defn menu-component [app owner]

    (.click download-link)))


(defn download-history-animation [blob]
  (let [download-link (. js/document (getElementById "image-download-link"))]
    (println "done!")
    (set! (.-href download-link) (.createObjectURL js/URL blob))
    (.click download-link)))

(defn export-history-animation []
  (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])

    (will-mount [_]
       (let [clickchan (om/get-state owner :clickchan)]
        (go (loop []
          (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
