1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-27 17:19:31 +00:00

uqt.signal

This commit is contained in:
Étienne Fildadut 2019-12-27 18:54:30 +01:00
parent 82bc7268e6
commit f6fb8ad649
11 changed files with 331 additions and 80 deletions

View file

@ -1,5 +1,9 @@
--- ubiquitousse.timer
-- Depends on a backend.
-- Optional dependencies: ubiquitousse.signal (to bind to update signal in signal.event)
local loaded, signal = pcall(require, (...):match("^(.-)timer").."signal")
if not loaded then signal = nil end
local ease = require((...):match("^.-timer")..".easing")
local timer
@ -332,7 +336,7 @@ timer = {
-- @impl ubiquitousse
delayed = {},
lastTime = 0,
update = function(...)
update = function(...) -- If ubiquitousse.signal is available, will be bound to the "update" signal in signal.event.
return registry_mt.update(timer, ...)
end,
run = function(...)
@ -346,4 +350,9 @@ timer = {
end
}
-- Bind signals
if signal then
signal.event:bind("update", timer.update)
end
return timer