Add current event to tag function?
YourFutureHusband opened this issue ยท 3 comments
I couldt find a method to retrieve the current event that triggered a certain tag function.
- So lets say for example you create a custom tag function for a 'name' tag (also updating the tag with 3 different events).
- But want to run a certain part of that custom function, depending on the event that triggered the func.
I managed to fix the issue by updating the oUF-tag-file and adding a new entry in the fontstring's parent, like so: 'fontstring.parent.event = event' in the 'OnEvent' script.
Any ideas on how to do this without 'hacking' the original files? Or maybe have plans to add this info in the future for cleaner and more efficient code?
#439 would rather pass the event and its arguments to the tag functions instead of storing the event in .parent.event
. parent
is the unit frame to which the fontstring object is attached, so it is not the best place to store information concerning just the tags. Also the event args might spare you some function calls depending on what the event provides. The event handling in the tag functions might get messy though, especially for compound tags, because all the individual tags will be updated for the occurring event even if a specific tag does not register the event itself. You will also have to handle the OnShow
and OnUpdate
cases, meaning you can't rely on the event arguments in those cases.
Currently we are leaning towards not adding this because we don't see much benefit in the feature. Unless you provide a reasonable use case, we will close this with a "wont fix" resolution.
The event handling in the tag functions might get messy though, especially for compound tags, because all the individual tags will be updated for the occurring event even if a specific tag does not register the event itself. You will also have to handle the OnShow and OnUpdate cases, meaning you can't rely on the event arguments in those cases.