WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   "Event Handler Wrapper"? (https://www.wowinterface.com/forums/showthread.php?t=4191)

JIM the Inventor 03-28-06 02:52 PM

"Event Handler Wrapper"?
 
I've just been browsing through the 1.10 discussion thread, shown here:

http://forums.worldofwarcraft.com/th...n&T=286547&P=8

On that page, Iriel and slouken discuss the passing of parameters to On- events (in XML):

Quote:

Q u o t e:
I'm not sure if that's doable either, but if the globals were still set the way they are now, code written in On* blocks could stay as it is today, and code that wishes to take advantage of parameters in the XML could call this:SetScript in the OnLoad block.

-- end Iriel quote -- begin slouken quote --

That means that every dispatch of a handler would have to both set global variables and put them on the stack. It seems like a lot of work for a minority case.

I'll point out that you could easily have this in your own code by creating an event dispatch wrapper that does this.
Whoa! I thought the events were generally untouchable by us authors! What's he talking about? How would one write an event wrapper? Does this imply that we can produce events as well?

Esamynn 03-28-06 03:04 PM

By a wrapper, slouken was refering to an event dispatch system for your own AddOn. I believe Ace does something like this in that Ace AddOns register events with a dispatch system that is part of Ace instead of the with the default API. When an event fires the API passes the event to the wrapper which in turn passes the event to the OnEvent function.

Kaelten 03-28-06 03:18 PM

acttually in ace's case we do something like this in the lua

self:Hook("function")

and that will call the same named function thats part of your addon.

JIM the Inventor 03-28-06 03:37 PM

Quote:

Originally Posted by jbcc
By a wrapper, slouken was refering to an event dispatch system for your own AddOn. <snip>. When an event fires the API passes the event to the wrapper which in turn passes the event to the OnEvent function.

Ah. Disappointing.

Okay then. Thank you very much. (I'll just go on faking Blizzard events as best I can. :) )

Kaelten 03-28-06 03:47 PM

thea fun thing is you can simulate fake events and even trigger events using Ace's system

Esamynn 03-28-06 06:40 PM

Quote:

Originally Posted by Kaelten
acttually in ace's case we do something like this in the lua

self:Hook("function")

and that will call the same named function thats part of your addon.

Yah, I didn't really know any details, I just knew that Ace has a centralized event system so it made a good example. :)


All times are GMT -6. The time now is 07:02 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI