WoW:USERAPI Frame UnregisterEvents

Revision as of 12:48, 5 January 2008 by WoWWiki>Egingell (New page: {{userfunc}} __NOTOC__ Add this method to your frame to register multiple events. == Code == local function UnregisterEvents(self, ...) for _,event in pairs({...}) do self...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This page documents a <i>user-defined function</i> that you can copy and paste into your addon. Replace PREFIX with your addon or lib prefix to avoid conflicts between different versions of these functions.

User defined functions


Add this method to your frame to register multiple events.

Code

local function UnregisterEvents(self, ...)
    for _,event in pairs({...}) do
        self:UnregisterEvent(event)
    end
end

Example

local frame = YourEventFrame
frame.UnregisterEvents = UnregisterEvents

-- Tell the API to stop listen for 'VARIABLES_LOADED', 'ADDON_LOADED', and 'MERCHANT_SHOW'
frame:UnregisterEvents('VARIABLES_LOADED', 'ADDON_LOADED', 'MERCHANT_SHOW')

Or unregister events for a frame without creating a new "frame.UnregisterEvents" variable:

local frame = YourEventFrame

-- Tell the API to stop listen for 'VARIABLES_LOADED', 'ADDON_LOADED', and 'MERCHANT_SHOW'
UnregisterEvents(frame, 'VARIABLES_LOADED', 'ADDON_LOADED', 'MERCHANT_SHOW')