Interceptors in re-dash work similar to re-frame, so head over there for detailed documentation
Out the box, re-dash supports the following interceptors
Log useful information during event execution, see debugging
Inject coeffects into the cofx
map that we can use inside our event handlers, see coeffects
An interceptor which acts somewhat like clojure.core/update-in
, in the sense that the event handler is given a specific part of app-db to change, not all of app-db, see path
An interceptor is simply a map with the following structure:
{:id :my-cool-interceptor
:before before-fn
:after after-fn}
There's also a convenience function provided to build an interceptor:
(rd/->interceptor
:my-cool-interceptor
before-fn
after-fn)
before-fn
and after-fn
are functions with one argument which is the event context
. See re-frame's documentation for more detail.
Registers the given interceptor as a global interceptor. Global interceptors are included in the processing chain of every event.
Also see: Global Interceptors
Add this somewhere early on in your app's startup, like in main
(rd/reg-global-interceptor
(rd/debug))