Closed jordond closed 5 years ago
I didn't add those myself since this looks a bit misleading to me:
on<SomeAction> {
sample { state, someAction -> ... }
}
It would suggest that Sample
is only invoked on SomeAction
like the other built-in targeted interceptions, although it only works in conjunction with the if (action is T)
statement and is actually invoked on every action.
Maybe we could come up with some type of base class, like TargetedInterception
that takes care of the conditional invocation, although it might get ugly without reified types…
In
Interceptions.Builder
there is aadd
function that allows adding custom interceptions using the DSL. I have just added these functions to theInterceptions.Targeted.Builder
as well.This allows you to write custom
Interception
's, and extension functions for them like: