Change UnRegister to Unregister, allow array to unregister more than one event/suffix
This commit is contained in:
parent
e2e49a7816
commit
10352297aa
|
@ -1,4 +1,4 @@
|
|||
local lib = LibStub:NewLibrary("LibCombatLog", 16)
|
||||
local lib = LibStub:NewLibrary("LibCombatLog", 17)
|
||||
if not lib then return end
|
||||
local CombatLogGetCurrentEventInfo, pairs, unpack, type = CombatLogGetCurrentEventInfo, pairs, unpack, type
|
||||
lib.mixinTargets = lib.mixinTargets or {}
|
||||
|
@ -87,9 +87,16 @@ function lib:RegisterCLSuffix(suffix, funcName)
|
|||
lib['regs'][suffix][self] = funcName
|
||||
end
|
||||
end
|
||||
function lib:UnRegisterCLSuffix(suffix)
|
||||
if(lib['regs'][suffix]) then
|
||||
lib['regs'][suffix][self] = nil
|
||||
function lib:UnregisterCLSuffix(suffix)
|
||||
if(type(suffix) ~= "string" and funcName) then
|
||||
for _,v in pairs(suffix) do
|
||||
self:UnregisterCLSuffix(v)
|
||||
end
|
||||
return
|
||||
else
|
||||
if(lib['regs'][suffix]) then
|
||||
lib['regs'][suffix][self] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
function lib:RegisterCLEvent(event,funcName)
|
||||
|
@ -107,12 +114,19 @@ end
|
|||
function lib:RegisterCLStatus(funcName)
|
||||
lib['regs']['PLAYER_REGEN'][self] = funcName
|
||||
end
|
||||
function lib:UnRegisterCLStatus()
|
||||
function lib:UnregisterCLStatus()
|
||||
lib['regs']['PLAYER_REGEN'][self] = nil
|
||||
end
|
||||
function lib:UnRegisterCLEvent(event)
|
||||
if(lib['regs'][event]) then
|
||||
lib['regs'][event][self] = nil
|
||||
function lib:UnregisterCLEvent(event)
|
||||
if(type(event) ~= "string" and funcName) then
|
||||
for _,v in pairs(event) do
|
||||
self:UnregisterCLEvent(v)
|
||||
end
|
||||
return
|
||||
else
|
||||
if(lib['regs'][event]) then
|
||||
lib['regs'][event][self] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
function lib:Embed(target)
|
||||
|
|
Loading…
Reference in New Issue