-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
32 lines (26 loc) · 1 KB
/
main.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
local addonName, ns = ...
ns.playerClass = select(2, UnitClass("player"))
-- Module class
ns.Module = {
new = function(self, obj)
obj = obj or {}
setmetatable(obj, self)
self.__index = self
obj:BuildEventManager()
return obj
end,
BuildEventManager = function(self)
local eventManager = CreateFrame("Frame")
eventManager:SetScript("OnEvent", function(frame, event, ...) self[event](self, ...) end)
self.EventManager = eventManager
end,
RegisterEvent = function(self, event) self.EventManager:RegisterEvent(event) end,
RegisterUnitEvent = function(self, event, ...) self.EventManager:RegisterUnitEvent(event, ...) end,
UnregisterEvent = function(self, event, ...) self.EventManager:UnregisterEvent(event) end,
UnregisterAllEvents = function(self, event, ...) self.EventManager:UnregisterAllEvents() end,
}
-- must wait until ADDON_LOADED before calling GetDB
function ns:GetDB()
stakoTweaksDB = stakoTweaksDB or {}
return stakoTweaksDB
end