mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-26 05:50:50 +00:00
add pfUI.events callback registry, replace addoncompat OnUpdate poll
Introduce a central pfUI.events registry (ClassicAPI's CallbackRegistryMixin, undefined events allowed) initialized in pfUI.lua before any module body runs, so publishers/subscribers don't depend on module load order. firstrun sets `pfUI.firstrun.completed` and fires `firstrun:complete` at the point NextStep detects no pending steps. PLAYER_ENTERING_WORLD re- enters this path on every zone, so the flag is a one-shot guard. addoncompat drops its 0.1s OnUpdate poll and either RunQueues immediately (returning user, all steps already done) or subscribes to the event.
This commit is contained in:
+4
-14
@@ -134,19 +134,9 @@ pfUI:RegisterModule("addoncompat", function ()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- run the addonconflict queue when firstrun is ready
|
-- run the addonconflict queue when firstrun is ready
|
||||||
local delay = CreateFrame("Frame")
|
if pfUI.firstrun and pfUI.firstrun.completed then
|
||||||
delay:SetScript("OnUpdate", function()
|
|
||||||
-- throttle to to one query per .1 second
|
|
||||||
if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + .1 end
|
|
||||||
|
|
||||||
-- make sure the firstrun dialog has finished
|
|
||||||
if pfUI.firstrun and pfUI.firstrun.steps then
|
|
||||||
for _, step in pairs(pfUI.firstrun.steps) do
|
|
||||||
if not pfUI_init[step.name] then return end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
RunQueue()
|
RunQueue()
|
||||||
this:SetScript("OnUpdate", nil)
|
else
|
||||||
end)
|
pfUI.events:RegisterCallback("firstrun:complete", RunQueue, "addoncompat")
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ pfUI:RegisterModule("firstrun", function ()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not self.completed then
|
||||||
|
self.completed = true
|
||||||
|
pfUI.events:TriggerEvent("firstrun:complete")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- main function to create wizard windows
|
-- main function to create wizard windows
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ pfUI.version = {}
|
|||||||
pfUI.hooks = {}
|
pfUI.hooks = {}
|
||||||
pfUI.env = {}
|
pfUI.env = {}
|
||||||
|
|
||||||
|
pfUI.events = Mixin({}, CallbackRegistryMixin)
|
||||||
|
pfUI.events:OnLoad()
|
||||||
|
pfUI.events:SetUndefinedEventsAllowed(true)
|
||||||
|
|
||||||
-- check if macro addons are loaded (disables macrotweak/macroscan)
|
-- check if macro addons are loaded (disables macrotweak/macroscan)
|
||||||
function pfUI:MacroAddonsLoaded()
|
function pfUI:MacroAddonsLoaded()
|
||||||
return IsAddOnLoaded("Supermacro") or IsAddOnLoaded("SuperCleveRoidMacros") or IsAddOnLoaded("UltimaMacros")
|
return IsAddOnLoaded("Supermacro") or IsAddOnLoaded("SuperCleveRoidMacros") or IsAddOnLoaded("UltimaMacros")
|
||||||
|
|||||||
Reference in New Issue
Block a user