LDB source not registered in ElvUI
esvarc opened this issue ยท 8 comments
LDB plugin library is not included in package and not listed in embeds.xml, in code is library required by:
local ls = LibStub("LibDataBroker-1.1", true)
This library is dynamicaly registered only after bar starts, but it need to be inicialized at load or it will not be recognized by addons supporting LDB like ElvUI, because list of available LDB sources is checked on application load. This change in code fix it and register as source. In fact there is no reason why not have support for LDB on even if candybar is primary target.
local ls = LibStub("LibDataBroker-1.1", true)
local obj = ls:NewDataObject("LegionInvasionTimer", {type = "data source", icon = 132177, text = "..."})
function obj.OnTooltipShow(tooltip)
if not tooltip or not tooltip.AddLine or not tooltip.AddDoubleLine then return end
ShowTip(tooltip)
end
local prevTime, label, repeater = 0, "", false
local function update()
prevTime = prevTime - 60
obj.text = label..": ".. SecondsToTime(prevTime, true)
end
startBroker = function(text, timeLeft, icon)
if obj then
obj.icon = icon
obj.text = text..": ".. SecondsToTime(timeLeft, true)
prevTime = timeLeft
label = text
if repeater then repeater:Cancel() end
repeater = C_Timer.NewTicker(60, update)
end
end
end
LDB is not embedded in LIT by default, it assumes the display addon will embed it.
I'm going to assume ElvUI does not embed it either, in which case this might be a situation where you have no instances of the library loaded.
edit: No, I'm wrong. ElvUI does embed LDB, so I'm not sure where your problem lies.
I recommend you install BugSack as you may be encountering an error somewhere.
I do have it embed in another addons. Until I did move registraction LDB to this part of inicialization in static do end cycle. ElvUI never did offer LegionTimer as source for datatext under bars. But usually all addons offering DLB have it embeded. ElvUI won't embed library because ElvUI is target for LDB plugins.
ElvUI already is embedding LDB.
Anyway, I've embedded it into LIT, not that I think this will solve whatever issue you're having.
This original code don't register LDB for ElvUI use:
local obj
local prevTime, label, repeater = 0, "", false
local function update()
prevTime = prevTime - 60
obj.text = label..": ".. SecondsToTime(prevTime, true)
end
startBroker = function(text, timeLeft, icon)
if not obj then
obj = LibStub("LibDataBroker-1.1"):NewDataObject("LegionInvasionTimer", {type = "data source", icon = icon, text = text..": ".. SecondsToTime(timeLeft, true)})
function obj.OnTooltipShow(tooltip)
if not tooltip or not tooltip.AddLine or not tooltip.AddDoubleLine then return end
ShowTip(tooltip)
end
end
if obj then
And this modified does.
local obj = LibStub("LibDataBroker-1.1"):NewDataObject("LegionInvasionTimer", {type = "data source", icon = icon, text = "..."})
function obj.OnTooltipShow(tooltip)
if not tooltip or not tooltip.AddLine or not tooltip.AddDoubleLine then return end
ShowTip(tooltip)
end
local prevTime, label, repeater = 0, "", false
local function update()
prevTime = prevTime - 60
obj.text = label..": ".. SecondsToTime(prevTime, true)
end
startBroker = function(text, timeLeft, icon)
if obj then