-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathShim.lua
35 lines (30 loc) · 857 Bytes
/
Shim.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
28
29
30
31
32
33
34
35
local WagoAnalyticsShim = LibStub:NewLibrary("WagoAnalytics", 2)
local GetAddOnMetadata = C_AddOns and C_AddOns.GetAddOnMetadata or GetAddOnMetadata
if not WagoAnalyticsShim then
return
end
function WagoAnalyticsShim:Register(wagoID)
local WagoAnalytics = WagoAnalytics
if WagoAnalytics then
return WagoAnalytics:Register(wagoID)
else
return setmetatable({}, {
__index = {
IncrementCounter = function() end,
DecrementCounter = function() end,
SetCounter = function() end,
Switch = function() end,
Error = function() end,
Breadcrumb = function() end
}
})
end
end
function WagoAnalyticsShim:RegisterAddon(addonName)
local wagoID = GetAddOnMetadata(addonName, "X-Wago-ID")
if not wagoID then
return false
end
return self:Register(wagoID)
end
WagoAnalyticsShim.RegisterAddOn = WagoAnalyticsShim.RegisterAddon