Fandom

WoWWiki

API Frame RegisterAllEvents

104,632pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Widget API ← Frame < RegisterAllEvents

Registers a frame to receive all fired events; it is not advisable to use this for anything except debugging purposes, as the incurred performance penalty is quite large.

frame:RegisterAllEvents();

ExampleEdit

-- Addon '\Interface\Addons\My Addon'
MySavedVariables_Table = {} -- Global (not PerCharacter) SavedVariable
local frame = CreateFrame('Frame')
frame:RegisterAllEvents()
frame:SetScript('OnEvent',
    function(self, event, ...)
        -- Save only the last instance of the fired event.
        MySavedVariables_Table[event] = {...};
    end
)

ResultEdit

File '\WTF\Account\(...)\SavedVariables\My Addon.lua' will contain the MySavedVariables_Table variable, formatted something like this:

MySavedVariables_Table = {
    ["ADDON_LOADED"] = {
        [1] = "Some other addon",
    },
    ["ADDON_ACTION_FORBIDDEN"] = {
        [1] = "Some other addon",
        [2] = "CastSpellByName",
    },
    ...
}

Also on Fandom

Random Wiki