deleted a redundant "can "
No edit summary |
(deleted a redundant "can ") |
||
| Line 1: | Line 1: | ||
{{eventapi}} | {{eventapi}}Events are messages sent by the WoW client to UI code (OnEvent script handlers of Frame derivatives), mostly in reaction to things occurring in the game world. To process events, an addon needs to create an event handler and register it for the events it wishes to receive. | ||
Events are messages sent by the WoW client to UI code (OnEvent script handlers of Frame derivatives), mostly in reaction to things occurring in the game world. To process events, an addon needs to create an event handler and register it for the events it wishes to receive. | |||
== Setting up an event handler == | == Setting up an event handler == | ||
| Line 11: | Line 10: | ||
The addon's OnEvent script handler function should either handle the event, or call another addon function to handle the event. | The addon's OnEvent script handler function should either handle the event, or call another addon function to handle the event. | ||
In order to receive event notifications, the event handler frame needs to be registered for events the addon needs to handle; use frame:[[API_Frame_RegisterEvent|RegisterEvent]]("eventName") to achieve this. The RegisterEvent function | In order to receive event notifications, the event handler frame needs to be registered for events the addon needs to handle; use frame:[[API_Frame_RegisterEvent|RegisterEvent]]("eventName") to achieve this. The RegisterEvent function can be called at any time after the frame's creation; the OnLoad script handler is a convenient location to register for the desired events when using XML. | ||
If you no longer wish to receive event notifications for a particular event, use the frame:[[API_Frame_UnregisterEvent|UnregisterEvent]]() function. If you wish to disable all event notifications currently delivered to a frame, use the frame:[[API_Frame_UnregisterAllEvents|UnregisterAllEvents]](). | If you no longer wish to receive event notifications for a particular event, use the frame:[[API_Frame_UnregisterEvent|UnregisterEvent]]() function. If you wish to disable all event notifications currently delivered to a frame, use the frame:[[API_Frame_UnregisterAllEvents|UnregisterAllEvents]](). | ||