UIHANDLER OnEvent

The OnEvent handler allows a to respond to state changes (Events) to which it.

frame:HookScript("OnEvent", function(self, event, ...)  -- Do something  end);

Arguments

 * self : - Reference to the frame who had registered for the event.
 * event : String - Full name of the triggered event.
 * ... : Vararg Function - Variable number of remaining arguments representing the payload of each event.

Examples
The following examples show a frame that responds to many different events, including one with a payload that is transcribed to arg1 through arg4: local myFrame = CreateFrame("Frame") myFrame:HookScript("OnEvent", function(__, event, arg1, arg2, arg3, arg4)  if (event == "PLAYER_LOGIN") then     -- The player just logged in (payload: none)    elseif (event == "PLAYER_REGEN_DISABLED") then     -- The player is about to enter combat (payload: none)    elseif (event == "PLAYER_REGEN_ENABLED") then     -- The player just left combat (payload: none)    elseif (event == "UNIT_SPELLCAST_SENT" and arg1 == "player" and arg4 == "1459") then     -- I am casting arcane intellect (payload: unit, target, castGUID, spellID)    end end); myFrame:RegisterEvent(""); myFrame:RegisterEvent(""); myFrame:RegisterEvent(""); myFrame:RegisterEvent("");