mirror of
https://github.com/britzl/monarch.git
synced 2025-09-28 02:22:20 +02:00
Wait with screen unload until next screen is loaded and ready to be shown (#74)
* Removed screen flicker when transitioning between screens * Moved advanced example to subfolder. Added basic example. * Remove flicker on back navigation too * Fix issue with no_stack screens added at any time
This commit is contained in:
@@ -4,7 +4,10 @@ function M.seconds(amount)
|
||||
local co = coroutine.running()
|
||||
assert(co, "You must run this from within a coroutine")
|
||||
timer.delay(amount, false, function()
|
||||
coroutine.resume(co)
|
||||
local ok, err = coroutine.resume(co)
|
||||
if not ok then
|
||||
print(err)
|
||||
end
|
||||
end)
|
||||
coroutine.yield()
|
||||
end
|
||||
@@ -13,10 +16,13 @@ function M.eval(fn, timeout)
|
||||
local co = coroutine.running()
|
||||
assert(co, "You must run this from within a coroutine")
|
||||
local start = socket.gettime()
|
||||
timer.delay(0.01, true, function(self, handle, time_elapsed)
|
||||
timer.delay(0.02, true, function(self, handle, time_elapsed)
|
||||
if fn() or (timeout and socket.gettime() > (start + timeout)) then
|
||||
timer.cancel(handle)
|
||||
coroutine.resume(co)
|
||||
local ok, err = coroutine.resume(co)
|
||||
if not ok then
|
||||
print(err)
|
||||
end
|
||||
end
|
||||
end)
|
||||
coroutine.yield()
|
||||
|
Reference in New Issue
Block a user