-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.lua
42 lines (35 loc) · 887 Bytes
/
api.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
36
37
38
39
40
41
local n, ns = ...
local core = ns.core
local function error_handler(...)
local message = strjoin(" ", ...)
_G.geterror_handler()(format("%s |cffff3860[ERROR]|r\n%s", "AdiBagsElvUISkinAPI", message))
end
function ns.callApi(wType, frame)
local funcList = ns.api[wType]
if not funcList then
return
end
for i = 1, #funcList do
if funcList[i] then
xpcall(funcList[i], error_handler, frame)
end
end
end
ns.api = {
moduleButton = {},
itemButton = {},
frame = {}
}
-- USAGE:
-- [create your style function first]
-- local function myStyle(frame)
-- doSomething(frame)
-- end
-- [register your style function]
-- AddAdiBagsElvUISkinPostHook("frame", myStyle)
function AddAdiBagsElvUISkinPostHook(type, func)
if not func or not ns.api[type] then
return
end
tinsert(ns.api[type], func)
end