[Discarded] LibTotemInfo

[Discarded] LibTotemInfo

14.7k Downloads

Add a GetTotemTimeLeft() shim

Road-block opened this issue ยท 1 comments

commented

Adding a shim for the other totem function missing

function lib.GetTotemTimeLeft(elem)
  local _, _, startTime, duration = lib.GetTotemInfo(elem)
  local now = GetTime()
  local expiration = startTime and duration and (startTime + duration)
  if expiration and now < expiration then
    return expiration - now
  end
  return 0
end
-- Exposing GetTotemTimeLeft() to other addons
if type(GetTotemTimeLeft) ~= 'function' then
  GetTotemTimeLeft = lib.GetTotemTimeLeft
end

Would allow addons like PitBull4 to embed the library and have them work.

commented

merged to 7877d97