classy_hook ¶Module responsible for managing the hooks.
-spec first_match(hookpoint(), list()) -> {ok, _Val} |
undefined.
Return result of the first hook that returned {ok, _} for
a given set of arguments.
-spec all(hookpoint(), list()) -> ok | {error, _}.
Ensure that all functions hooked into Hookpoint return ok.
If any function returns other value or throws an exception,
this function returns {error, _}.
-spec map(hookpoint(), list()) -> list().
Apply every hook to the arguments and return the list of outputs for each hook.
Failures are ignored (logged).
-spec fold(hookpoint(), list(), A) -> A.
Fold over all functions registered in Hookpoint.
Accumulator argument is appended to the Args list.
Errors are ignored (logged).
-spec foreach_rev(hookpoint(), list()) -> ok.
Similar to foreach/2,
but hooks run in reverse priority order.
-spec foreach(hookpoint(), list()) -> ok.
Apply all functions hooked into Hookpoint to arguments Args.
Errors are ignored (logged).
-spec unhook(hook()) -> ok.
Remove a previously inserted hook.
-spec insert(hookpoint(), fun(), prio()) -> hook().
Get the configured hook timeout value (with defaults).