Automated update from: http://smariot.hopto.org/translate
[QuestHelper.git] / manager_event.lua
blob0695eb6deb163223752ac886950c3efd67e407ad
1 QuestHelper_File["manager_event.lua"] = "Development Version"
2 QuestHelper_Loadtime["manager_event.lua"] = GetTime()
4 local frame = CreateFrame("Frame")
6 local EventRegistrar = {}
8 local function OnEvent(_, event, ...)
9 local tstart = GetTime()
10 for _, v in pairs(EventRegistrar[event]) do
11 v(...)
12 end
13 QH_Timeslice_Increment(GetTime() - tstart, "manager_event")
14 end
16 frame:UnregisterAllEvents()
17 frame:SetScript("OnEvent", OnEvent)
19 frame:Show()
21 function QuestHelper.EventHookRegistrar(event, func)
22 QuestHelper:Assert(func)
23 if not EventRegistrar[event] then
24 frame:RegisterEvent(event)
25 EventRegistrar[event] = {}
26 end
27 table.insert(EventRegistrar[event], func)
28 end
30 --[[
31 function QuestHelper.OnUpdateHookRegistrar(func)
32 QuestHelper: Assert(func)
33 table.insert(OnUpdateRegistrar, func)
34 end