"Correct" way to monitor custom events?
So, probably a stupid question, but is there a "correct" way to handle behavior dependent on custom events in oUF?
By which I mean, say for instance I want to tint the target frame's backdrop based on unit reaction. This obviously needs to be updated on a target change and also on (I think?) UNIT_FACTION. Should I just be directly registering for these events and handling the behavior in my own functions, or is there some sort of hook/register/postupdate system oUF has that I ought to be using? Obviously if the thing I wanted to change was a text string I'd just use tags... and I briefly considered abusing the convenience of the tag system for these purposes but I'm guessing that's not a good idea. |
It's pretty similar to how you would do it in the normal cases:
Code:
frame:RegisterEvent('EVENT1', myEventFunc) |
A slight side note which I forgot (it's soon 6AM here after all :p):
The event system in oUF handles multiple event handlers on a single-event automatically. This behavior is very uncommon for add-ons to use. Mostly because you always have a split between the different systems. Let's take the following code as an example: Code:
frame:RegisterEvent('EVENT1', myFunc1) The reason it works this way is mostly because I wanted a simple and transparent way to register multiple handlers onto a single event, without removing the ability to call them all through the ordinary syntax. This is also the reason why you should provide the handler when you unregister the event. You can get quite the unexpected behavior if you don't :). |
All times are GMT -6. The time now is 02:05 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI