Hey everyone,
Thanks for taking the time to read my question. I'll keep things short:
What's the best way to keep hook functions from ignoring emitted events? I understand that returning null effectively bleeps out the event, but it seems that all the other hook functions still take the time to 'look' at this nullified event.
I have a program with 5 or 6 hook functions, but only one of them is called frequently. Instead of all 6 functions checking the event's data per emitted event, I'd much rather have the 'frequent' hook function check all events first, and completely intercept them if they are the appropriate type of event: This would mean that 95% or more of all emitted events would be intercepted by that first hook function, requiring only 1 conditional for every event instead of requiring 6 conditional checks for every event. This becomes significant because I am emitting tens of events per second.
I know this could be done quite easily through a hierarchical Select-Case block, acting as a 'Master Hook Function', but I'd like to keep my hook functions as separate as possible for reusability purposes. Any advice?
Thanks for taking the time to read my question. I'll keep things short:
What's the best way to keep hook functions from ignoring emitted events? I understand that returning null effectively bleeps out the event, but it seems that all the other hook functions still take the time to 'look' at this nullified event.
I have a program with 5 or 6 hook functions, but only one of them is called frequently. Instead of all 6 functions checking the event's data per emitted event, I'd much rather have the 'frequent' hook function check all events first, and completely intercept them if they are the appropriate type of event: This would mean that 95% or more of all emitted events would be intercepted by that first hook function, requiring only 1 conditional for every event instead of requiring 6 conditional checks for every event. This becomes significant because I am emitting tens of events per second.
I know this could be done quite easily through a hierarchical Select-Case block, acting as a 'Master Hook Function', but I'd like to keep my hook functions as separate as possible for reusability purposes. Any advice?