   (p/set-document (:title @app) (:input @app))
   (om/update! app :titles (p/get-all-titles)))
 
+(defn listen [el type app]
+  (events/listen el type
+    #(when 
+       (and (.-metaKey %)
+            (= 83 (.-keyCode %)))
+       (.preventDefault %)
+       (save-document app))))
+
 (defn wordsmith-app [app owner]
   (reify
     om/IWillMount

        (go-loop []
          (let [[action params] (<! channel)]
            (save-document app)
            (recur)))))
    om/IRender
    (render [_]
      (dom/div #js {:className "container"}

            [wordsmith.editor :as e]
            [cljs.core.async :refer [put! chan <!]]
            [goog.string :as gstring]
            [goog.string.format]
            [goog.events :as events])
  (:import [goog.events EventType]))

(enable-console-print!)

