GetFramesRegisteredForEvent

From Warcraft Wiki
Jump to navigation Jump to search
Flavors
Links
Info
Added in 2.3.0 / 1.13.2

Returns all frames registered for the specified event, in dispatch order.

frame1, frame2, ... = GetFramesRegisteredForEvent(event)

Arguments

event
string - Event for which to return registered frames, e.g. "PLAYER_LOGOUT"

Returns

frame1, ...
Widget - widget registered for the specified event.

Details

  • The first frame returned will be the first to receive the given event, and likewise the last returned will receive the event last. A frame can be moved to the end of this event list order by unregistering and then reregistering for the event.
  • Currently, frames registered via Frame:RegisterAllEvents will be returned before all other frames, but they will actually receive events last (as they are used to profile the normal frames' handlers). This suggests that the above ordering is not always reliable. (Last checked 8.3.7)

Example

The snippet below unregisters the PLAYER_LOGOUT events from every frame listening for it

local function unregister(event, widget, ...)
 if widget then
  widget:UnregisterEvent(event)
  return unregister(event, ...)
 end
end
unregister("PLAYER_LOGOUT", GetFramesRegisteredForEvent("PLAYER_LOGOUT"))

Patch changes

Bc icon.gif Patch 2.3.0 (2007-11-13): Added.