Rework network to use timer instead of onupdate
This commit is contained in:
@@ -46,23 +46,15 @@ function shared.Network.Init()
|
||||
end
|
||||
end)
|
||||
|
||||
local function Update()
|
||||
local function NetworkTick()
|
||||
if not Heimdall_Data.config.network.enabled then return end
|
||||
if Heimdall_Data.config.network.debug then
|
||||
print("Network module is updating.")
|
||||
end
|
||||
ShowFriends()
|
||||
shared.network.ticker = C_Timer.NewTimer(Heimdall_Data.config.network.updateInterval, NetworkTick, 1)
|
||||
end
|
||||
|
||||
local networkFrame = CreateFrame("Frame")
|
||||
networkFrame:SetScript("OnUpdate", function(self, elapsed)
|
||||
if not Heimdall_Data.config.network.enabled then return end
|
||||
updateTime = updateTime + elapsed
|
||||
if updateTime >= Heimdall_Data.config.network.updateInterval then
|
||||
Update()
|
||||
updateTime = 0
|
||||
end
|
||||
end)
|
||||
Update()
|
||||
NetworkTick()
|
||||
print("[Heimdall] Network module loaded")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user