feat: fire ADDON_LOADED event after each addon finishes loading

Fire ADDON_LOADED(addonName) after all of an addon's files have been
executed. This is the standard WoW pattern for addon initialization —
addons register for this event to set up defaults after SavedVariables
are loaded:

  local f = CreateFrame("Frame")
  f:RegisterEvent("ADDON_LOADED")
  f:SetScript("OnEvent", function(self, event, name)
      if name == "MyAddon" then
          MyAddonDB = MyAddonDB or {defaults}
      end
  end)

Total addon events: 20.
This commit is contained in:
Kelsi 2026-03-20 12:52:25 -07:00
parent 05a37036c7
commit 66431ab762

View file

@ -89,6 +89,12 @@ bool AddonManager::loadAddon(const TocFile& addon) {
"' in addon '", addon.addonName, "' (XML frames not yet implemented)");
}
}
// Fire ADDON_LOADED event after all addon files are executed
// This is the standard WoW pattern for addon initialization
if (success) {
luaEngine_.fireEvent("ADDON_LOADED", {addon.addonName});
}
return success;
}