Rename apply-event to trim-v, allow handler to get vector of middleware
This commit is contained in:
parent
42d1d9e0e6
commit
1d2ffb0d4f
|
@ -21,7 +21,7 @@
|
|||
(def path middleware/path)
|
||||
(def validate middleware/validate)
|
||||
(def log-events middleware/log-events)
|
||||
(def apply-event middleware/apply-event)
|
||||
(def trim-v middleware/trim-v)
|
||||
|
||||
|
||||
|
||||
|
@ -32,4 +32,4 @@
|
|||
([id handler]
|
||||
(register-handler id pure handler))
|
||||
([id middleware handler]
|
||||
(register-handler id (comp pure middleware) handler)))
|
||||
(register-handler id [pure middleware] handler)))
|
||||
|
|
|
@ -19,7 +19,11 @@
|
|||
(swap! id->fn assoc event-id handler-fn))
|
||||
|
||||
([event-id middleware handler-fn]
|
||||
(register event-id (middleware handler-fn))))
|
||||
(let [mware (if (vector? middleware)
|
||||
(apply comp middleware) ;; compose the vector of middleware
|
||||
middleware)
|
||||
hander-fn (mware handler-fn)]
|
||||
(register event-id hander-fn))))
|
||||
|
||||
|
||||
;; -- The Event Conveyor Belt --------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue