-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCoreCompat.lua
27 lines (24 loc) · 1.02 KB
/
CoreCompat.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
local _, T = ...
--- @type SimpleAddonManager
local SAM = T.AddonFrame
local function getFunction(fun)
return (C_AddOns and C_AddOns[fun]) or _G[fun]
end
SAM.compat = {
EnableAddOn = getFunction("EnableAddOn"),
DisableAddOn = getFunction("DisableAddOn"),
IsAddOnLoaded = getFunction("IsAddOnLoaded"),
EnableAllAddOns = getFunction("EnableAllAddOns"),
DisableAllAddOns = getFunction("DisableAllAddOns"),
GetAddOnInfo = getFunction("GetAddOnInfo"),
GetAddOnDependencies = getFunction("GetAddOnDependencies"),
GetNumAddOns = getFunction("GetNumAddOns"),
SaveAddOns = getFunction("SaveAddOns"),
ResetAddOns = getFunction("ResetAddOns"),
IsAddonVersionCheckEnabled = getFunction("IsAddonVersionCheckEnabled"),
SetAddonVersionCheck = getFunction("SetAddonVersionCheck"),
IsAddOnLoadOnDemand = getFunction("IsAddOnLoadOnDemand"),
GetAddOnEnableState = (C_AddOns and C_AddOns.GetAddOnEnableState) or function(nameOrIndex, character)
return GetAddOnEnableState(character, nameOrIndex) -- the old API has inverted parameters
end
}