I'd just run
BuffFrame:Hide() by itself. There really isn't a need to wait for an event to fire.
It really depends on the frame and what its original code does. Lots of frames show and hide themselves. Fortunately,
BuffFrame does not.
-= Off-Topic =-
To respond to an event, you need to create a frame to listen for it. For readability, many people use a generic handler to redirect events to different functions stored in the frame's table.
Example:
Lua Code:
local EventFrame=CreateFrame("Frame");-- Create our frame and assign it to a local variable called EventFrame
EventFrame:RegisterEvent("PLAYER_ENTERING_WORLD");-- Register our frame to listen for PLAYER_ENTERING_WORLD
EventFrame:SetScript("OnEvent",function(self,event,...)-- Dynamic function to act as our script handler
if self[event] then self[event](self,event,...); end-- If we have a method stored in the frame's table, run it
end);
function EventFrame:PLAYER_ENTERING_WORLD(event,...)
-- Do Stuff
end
I personally prefer one of the more efficient ways of handling events, but this is explaining what you've seen others do.