mirror of
https://github.com/britzl/monarch.git
synced 2025-06-27 10:27:49 +02:00
Wait for popups when closing them
This commit is contained in:
parent
79df80df33
commit
38f95e0b5b
@ -568,11 +568,13 @@ function M.show(id, options, data, cb)
|
||||
|
||||
log("show()", screen.id)
|
||||
|
||||
local co
|
||||
co = coroutine.create(function()
|
||||
-- a screen can ignore the stack by setting the no_stack to true
|
||||
local add_to_stack = not options or not options.no_stack
|
||||
if add_to_stack then
|
||||
-- manipulate the current top
|
||||
-- close popup if needed
|
||||
-- close popup(s) if needed
|
||||
-- transition out
|
||||
local top = stack[#stack]
|
||||
if top then
|
||||
@ -580,10 +582,13 @@ function M.show(id, options, data, cb)
|
||||
if top.popup and screen.popup_on_popup then
|
||||
disable(top, screen)
|
||||
else
|
||||
-- close all popups
|
||||
-- close all popups, one by one
|
||||
while top.popup do
|
||||
stack[#stack] = nil
|
||||
show_out(top, screen, callbacks.track())
|
||||
show_out(top, screen, function()
|
||||
coroutine.resume(co)
|
||||
end)
|
||||
coroutine.yield()
|
||||
top = stack[#stack]
|
||||
end
|
||||
-- unload and transition out from top
|
||||
@ -610,6 +615,8 @@ function M.show(id, options, data, cb)
|
||||
show_in(screen, top, options and options.reload, add_to_stack, callbacks.track())
|
||||
|
||||
if cb then callbacks.when_done(cb) end
|
||||
end)
|
||||
coroutine.resume(co)
|
||||
|
||||
return true
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user