Fork me on GitHub
#re-frame
<
2020-04-09
>
thelittlesipper20:04:26

Is it possible to add interceptors to all registered events without having to go in and add the interceptor to each and every event one by one? I'm thinking of use-cases where you'd want to add some middleware-like behavior for all http-fx requests your application dishes out - wherein you'd have some interceptor you'd like all the events to go through (e.g. adding a required header to all requests)

phronmophobic20:04:53

that doesn’t work if you want to add interceptors from events added from libraries?

thelittlesipper20:04:46

being able to add global interceptors is good enough for me, atm - I'll make it work

phronmophobic20:04:56

there is an atom in re-frame/registrar in that holds all of the registered events, https://github.com/day8/re-frame/blob/69a3fcd411369fff65404e7d6a924ce1968e2dba/src/re_frame/registrar.cljc#L15 . you could muck with that, but it’s potentially a very bad idea ™️

💯 4
thelittlesipper20:04:12

I'll take a look, thanks