Fork me on GitHub
#re-frame
<
2020-02-28
>
adriel05:02:45

Hi all, clojure newb here. Been diving into re-frame and reagent and am wondering whether there is a way to auto-inject an interceptor for a re-frame event handler based on something like say the handler’s namespace.  The goal I have in mind is really just to abstract away having to sprinkle an interceptor all over a fairly large number of event handlers.  My first thought was to somehow jack-in to one of the two standard interceptors that the reg-event functions prepend to the interceptor chain. But I don’t like the idea of having conditional logic run on each and every event handler call to determine whether they need to push an additional interceptor into the queue. I guess then I would essentially have to write my own registration function? Any feedback/ideas or (even better) idiomatic ways to accomplish something like this would be much appreciated. Alternatively, it could be that just using my custom interceptor across a number of standard event registration declarations would end up being more maintainable anyway… :thinking_face: Thanks all!

adriel18:02:26

ah! excellent. Thanks. very much looking forward to https://github.com/day8/re-frame/issues/570!