-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Old Twitch strings fixed, bar border updated to the new framework border
- Loading branch information
Showing
10 changed files
with
168 additions
and
114 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
|
||
|
||
|
||
local DF = DetailsFramework | ||
local C_Timer = _G.C_Timer | ||
local unpack = _G.unpack | ||
|
||
--make a namespace for schedules | ||
DF.Schedules = {} | ||
|
||
--run a scheduled function with its payload | ||
local triggerScheduledTick = function(tickerObject) | ||
local payload = tickerObject.payload | ||
local callback = tickerObject.callback | ||
|
||
local result, errortext = pcall(callback, unpack(payload)) | ||
if (not result) then | ||
DF:Msg("error on scheduler: ", tickerObject.path, tickerObject.name, errortext) | ||
end | ||
return result | ||
end | ||
|
||
--schedule to repeat a task with an interval of @time | ||
function DF.Schedules.NewTicker(time, callback, ...) | ||
local payload = {...} | ||
local newTicker = C_Timer.NewTicker(time, triggerScheduledTick) | ||
newTicker.payload = payload | ||
newTicker.callback = callback | ||
newTicker.expireAt = GetTime() + time | ||
|
||
--debug | ||
newTicker.path = debugstack() | ||
-- | ||
return newTicker | ||
end | ||
|
||
--schedule a task with an interval of @time | ||
function DF.Schedules.NewTimer(time, callback, ...) | ||
local payload = {...} | ||
local newTimer = C_Timer.NewTimer(time, triggerScheduledTick) | ||
newTimer.payload = payload | ||
newTimer.callback = callback | ||
newTimer.expireAt = GetTime() + time | ||
|
||
--debug | ||
newTimer.path = debugstack() | ||
-- | ||
|
||
return newTimer | ||
end | ||
|
||
--cancel an ongoing ticker | ||
function DF.Schedules.Cancel(tickerObject) | ||
--ignore if there's no ticker object | ||
if (tickerObject) then | ||
return tickerObject:Cancel() | ||
end | ||
end | ||
|
||
--schedule a task with an interval of @time without payload | ||
function DF.Schedules.After(time, callback) | ||
C_Timer.After(time, callback) | ||
end | ||
|
||
function DF.Schedules.SetName(object, name) | ||
object.name = name | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters