3
0
mirror of https://github.com/britzl/monarch.git synced 2025-06-27 02:17:53 +02:00

Removed backward comp fix for monarch.back()

This commit is contained in:
Björn Ritzl 2024-01-12 08:31:48 +01:00
parent 00c30792a9
commit 4c6e26fd71
4 changed files with 4 additions and 14 deletions

View File

@ -29,7 +29,7 @@ function on_input(self, action_id, action)
end end
elseif gui.pick_node(self.no, action.x, action.y) then elseif gui.pick_node(self.no, action.x, action.y) then
print("no") print("no")
monarch.back(function() monarch.back(nil, nil, function()
print("back from popup done") print("back from popup done")
end) end)
end end

View File

@ -27,7 +27,7 @@ function on_input(self, action_id, action)
end) end)
elseif gui.pick_node(self.cancel, action.x, action.y) then elseif gui.pick_node(self.cancel, action.x, action.y) then
print("cancel") print("cancel")
monarch.back(function() monarch.back(nil, nil, function()
print("back from popup done") print("back from popup done")
end) end)
elseif gui.pick_node(self.about, action.x, action.y) then elseif gui.pick_node(self.about, action.x, action.y) then

View File

@ -19,7 +19,7 @@ function on_input(self, action_id, action)
end) end)
elseif gui.pick_node(self.back, action.x, action.y) then elseif gui.pick_node(self.back, action.x, action.y) then
print("back") print("back")
monarch.back(function() monarch.back(nil, nil, function()
print("back from pregame done") print("back from pregame done")
end) end)
end end

View File

@ -924,7 +924,7 @@ function M.hide(id, cb)
log("hide() you can only hide the screen at the top of the stack", id) log("hide() you can only hide the screen at the top of the stack", id)
return false return false
end end
return M.back(id, cb) return M.back(nil, nil, cb)
else else
log("hide() queuing action", id) log("hide() queuing action", id)
queue_action(function(action_done, action_error) queue_action(function(action_done, action_error)
@ -986,16 +986,6 @@ end
-- @param cb (function) - Optional callback to invoke when the previous screen is visible again -- @param cb (function) - Optional callback to invoke when the previous screen is visible again
function M.back(options, data, cb) function M.back(options, data, cb)
log("back() queuing action") log("back() queuing action")
-- backwards compatibility with old version M.back(data, cb)
-- case when back(data, cb)
if type(data) == "function" then
cb = data
data = options
options = nil
-- case when back(data, nil)
elseif options ~= nil and data == nil and cb == nil then
data = options
end
queue_action(function(action_done) queue_action(function(action_done)
local callbacks = callback_tracker() local callbacks = callback_tracker()