 
 (defn dispatch [eventv]
   (re-frame/dispatch eventv))
+
+(defn dispatch-sync [eventv]
+  (re-frame/dispatch-sync eventv))
+
+(defn subscribe [eventv]
+  (re-frame/subscribe eventv))
 
 (comment
 ;; start editable


     :save (partial save-fn [form-type identifier])
     :delete #(dispatch [:request/command (calculate-command form-type :delete) {:id identifier}])
     :reset  #(dispatch (e/editable-reset :todos identifier (state :reset)))
     :edit   #(dispatch [:editable
                         [:editable :todos identifier :state :reset (inputs)]
                         [:editable :todos identifier :state :editing true]])
     }))


;; helpers
(defn editable-reset [etype identifier inputs]
  [:editable
   [:editable etype identifier :inputs inputs]
   [:editable etype identifier :errors {}]
   [:editable etype identifier :state {}]])

(defn editable-error [etype identifier error]
  [:editable
   [:editable etype identifier :errors error]
   [:editable etype identifier :state {}]])

(defn editable-response
  ([etype identifier response]
   (editable-response etype identifier response {}))
  ([etype identifier response inputs]
   (conj (editable-reset etype identifier inputs)
         [:editable etype identifier :response response])))

(defn editable-transform
  "transforms an event vector that will update the db"
  [evec & attrs]
  (let [[channel form-type identifier] evec]
    (into [:editable form-type identifier] attrs)))

(defn editable-update
  "update the editable thing in the db,

                        (update-in things [id :inputs] merge args)
                        "delete"
                        (dissoc things id)))
      (dispatch [:response/command
                 ;; args in the response means update the editable thing's inputs
                 {:args (:inputs thing)
