Return nil when registering a handler
This commit is contained in:
parent
6df7320f97
commit
0ce1a04930
|
@ -63,12 +63,13 @@
|
||||||
\"re-frame.core/reg-event\" or \"re-frame.core/reg-event-fx\" would generally be used."
|
\"re-frame.core/reg-event\" or \"re-frame.core/reg-event-fx\" would generally be used."
|
||||||
([event-id handler-fn]
|
([event-id handler-fn]
|
||||||
(when (contains? @id->fn event-id)
|
(when (contains? @id->fn event-id)
|
||||||
(console :warn "re-frame: overwriting an event-handler for: " event-id)) ;; allow it, but warn.
|
(console :warn "re-frame: overwriting an event-handler for: " event-id)) ;; allow it, but warn.
|
||||||
(swap! id->fn assoc event-id handler-fn))
|
(swap! id->fn assoc event-id handler-fn)
|
||||||
|
nil)
|
||||||
|
|
||||||
([event-id middleware handler-fn]
|
([event-id middleware handler-fn]
|
||||||
(let [mid-ware (comp-middleware middleware) ;; compose the middleware
|
(let [mid-ware (comp-middleware middleware) ;; compose the middleware
|
||||||
midware+hfn (mid-ware handler-fn)] ;; wrap the handler in the middleware
|
midware+hfn (mid-ware handler-fn)] ;; wrap the handler in the middleware
|
||||||
(register-base event-id midware+hfn))))
|
(register-base event-id midware+hfn))))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue