correct use of list? to account for lazy seqs

This commit is contained in:
hipitihop 2016-07-20 17:16:01 +10:00
parent 25a197cdd9
commit 3c4b0791fc
1 changed files with 3 additions and 3 deletions

View File

@ -41,8 +41,8 @@
"There are cases where eitherone event is to be dipatch " "There are cases where eitherone event is to be dipatch "
[effect] [effect]
(cond (cond
(list? effect) (dorun (map dispatch effect))
(vector? effect) (dispatch effect) (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))) :else (console :error "re-frame: expected :dispatch effect to be a list or vector, but got: " effect)))
;; Example: ;; Example:
@ -88,14 +88,14 @@
(fn [val] (fn [val]
(cond (cond
(map? val) (process-one-entry val) (map? val) (process-one-entry val)
(list? val) (doall (map process-one-entry val))) ;; XXX add else (seq? val) (doall (map process-one-entry val))) ;; XXX add else
))) )))
(register (register
:deregister-event-handler :deregister-event-handler
(fn [val] (fn [val]
(if (list? val) (if (sequential? val)
(doall (map re-frame.events/clear-handler! val)) (doall (map re-frame.events/clear-handler! val))
(re-frame.events/clear-handler! val)))) (re-frame.events/clear-handler! val))))