 
 (defn dispatch-helper
   "There are cases where either one event is to be dipatched or a list of them"
-  [effect]
+  [event]
   (cond
-    (vector? effect) (dispatch effect)
-    (seq? effect)    (dorun (map dispatch effect))
-    :else (console :error "re-frame: expected :dispatch effect to be a list or vector, but got: " effect)))
+    (vector? event) (dispatch event)
+    (seq? event)    (dorun (map dispatch event))
+    :else (console :error "re-frame: expected :dispatch event to be a list or vector, but got: " event)))
 
 ;; Example:
 ;; {:dispatch-later {200  [:event-id "param"]    ;;  in 200ms do this: (dispatch [:event-id "param"])

(ns re-frame.fx
  (:require [re-frame.router :refer [dispatch]]
            [re-frame.db :refer [app-db]]
            [re-frame.events]
            [re-frame.interop :refer [ratom? set-timeout!]]
            [re-frame.loggers    :refer [console]]))


;; -- Registration ------------------------------------------------------------


      (set-timeout! #(dispatch-helper events) ms))))


;; Supply a vector. For example:
;;
;;   {:dispatch [:event-id "param"] }

(register
  :dispatch
  (fn [val]
    (when-not (vector? val)
      (console :warn "re-frame: :dispatch fx val expected vector got:" val))
    (dispatch val)))


;; Supply sequencial coll. For example:
;;
;;   {:dispatch-n (list [:do :all] [:three :of] [:these])}
;;
;; Coll can be anything that returns true to sequential? but should not be a map
;; NOTE: this does not include Set
(register
  :dispatch-n
  (fn [val]
    (when (or (-> val sequential? not) (map? val))
      (console :warn "re-frame: :dispatch-n fx val expected sequential not map got:" val))
    (doseq [event val] (dispatch event))))


(register
  :deregister-event-handler
  (fn [val]
    (if (sequential? val)
      (doall (map events/clear-handler! val))
      (events/clear-handler! val))))


(register
