Skip to content

Commit

Permalink
Added delay to async
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Aug 16, 2018
1 parent 42c9e75 commit a913373
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ludobits/m/async.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ function M.go_animate(url, property, playback, to, easing, duration, delay)
end)
end

function M.delay(delay)
return M.async(function(done)
local handle = timer.delay(delay, false, function()
done()
end)
if handle == timer.INVALID_TIMER_HANDLE then
print("Unable to create timer")
done()
end
end)
end

setmetatable(M, {
__call = function(t, ...)
return M.async(...)
Expand Down

0 comments on commit a913373

Please sign in to comment.