It would be nice if reg-fx handlers could take more than one arg. e.g.
(reg-event-fx ::big-red-button-clicked
(fn [_ _]
{:fx [[::change-world 1 2 3]]}))
(reg-fx ::change-world
(fn [a b c]
(xxx a b c)))
Seems like a modest change to reg-fx :fx would allow this...
Before...
(reg-fx
:fx
(fn [seq-of-effects]
(if-not (sequential? seq-of-effects)
(console :error "re-frame: \":fx\" effect expects a seq, but was given " (type seq-of-effects))
(doseq [[effect-key effect-value] (remove nil? seq-of-effects)]
(when (= :db effect-key)
(console :warn "re-frame: \":fx\" effect should not contain a :db effect"))
(if-let [effect-fn (get-handler kind effect-key false)]
(effect-fn effect-value)
(console :warn "re-frame: in \":fx\" effect found " effect-key " which has no associated handler. Ignoring."))))))
After...
(reg-fx
:fx
(fn [seq-of-effects]
(if-not (sequential? seq-of-effects)
(console :error "re-frame: \":fx\" effect expects a seq, but was given " (type seq-of-effects))
; NEW
(doseq [[effect-key & effect-values] (remove nil? seq-of-effects)]
(when (= :db effect-key)
(console :warn "re-frame: \":fx\" effect should not contain a :db effect"))
(if-let [effect-fn (get-handler kind effect-key false)]
; NEW
(apply effect-fn effect-values)
(console :warn "re-frame: in \":fx\" effect found " effect-key " which has no associated handler. Ignoring."))))))