mirror of
https://github.com/britzl/monarch.git
synced 2025-06-27 18:37:46 +02:00
Simplified message constant. Added focus message
This commit is contained in:
parent
e7edfbe173
commit
95fd994fa0
@ -6,8 +6,8 @@ local stack = {}
|
|||||||
|
|
||||||
|
|
||||||
M.TRANSITION_DONE = hash("transition_done")
|
M.TRANSITION_DONE = hash("transition_done")
|
||||||
M.MONARCH_CONTEXT = hash("monarch_context")
|
M.CONTEXT = hash("monarch_context")
|
||||||
M.MONARCH_FOCUS_GAINED = hash("monarch_focus_gained")
|
M.FOCUS_GAINED = hash("monarch_focus_gained")
|
||||||
|
|
||||||
|
|
||||||
local function screen_from_proxy(proxy)
|
local function screen_from_proxy(proxy)
|
||||||
@ -58,7 +58,7 @@ local function show_out(screen, next_screen, cb)
|
|||||||
co = coroutine.create(function()
|
co = coroutine.create(function()
|
||||||
screen.co = co
|
screen.co = co
|
||||||
msg.post(screen.script, "release_input_focus")
|
msg.post(screen.script, "release_input_focus")
|
||||||
msg.post(screen.script, "monarch_context")
|
msg.post(screen.script, M.CONTEXT)
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
if not next_screen.popup then
|
if not next_screen.popup then
|
||||||
msg.post(screen.transition_url, "transition_show_out")
|
msg.post(screen.transition_url, "transition_show_out")
|
||||||
@ -73,10 +73,12 @@ local function show_out(screen, next_screen, cb)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function show_in(screen, cb)
|
local function show_in(screen, cb)
|
||||||
|
print("hsow", screen)
|
||||||
|
pprint(screen)
|
||||||
local co
|
local co
|
||||||
co = coroutine.create(function()
|
co = coroutine.create(function()
|
||||||
screen.co = co
|
screen.co = co
|
||||||
msg.post(screen.script, "monarch_context")
|
msg.post(screen.script, M.CONTEXT)
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
msg.post(screen.proxy, "async_load")
|
msg.post(screen.proxy, "async_load")
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
@ -98,7 +100,7 @@ local function back_in(screen, previous_screen, cb)
|
|||||||
local co
|
local co
|
||||||
co = coroutine.create(function()
|
co = coroutine.create(function()
|
||||||
screen.co = co
|
screen.co = co
|
||||||
msg.post(screen.script, "monarch_context")
|
msg.post(screen.script, M.CONTEXT)
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
if not previous_screen.popup then
|
if not previous_screen.popup then
|
||||||
msg.post(screen.proxy, "async_load")
|
msg.post(screen.proxy, "async_load")
|
||||||
@ -219,7 +221,7 @@ function M.on_message(message_id, message, sender)
|
|||||||
elseif message_id == hash("proxy_unloaded") then
|
elseif message_id == hash("proxy_unloaded") then
|
||||||
local screen = screen_from_proxy(sender)
|
local screen = screen_from_proxy(sender)
|
||||||
assert(screen, "Unable to find screen for unloaded proxy")
|
assert(screen, "Unable to find screen for unloaded proxy")
|
||||||
elseif message_id == M.MONARCH_CONTEXT then
|
elseif message_id == M.CONTEXT then
|
||||||
local screen = screen_from_script()
|
local screen = screen_from_script()
|
||||||
assert(screen, "Unable to find screen for current script url")
|
assert(screen, "Unable to find screen for current script url")
|
||||||
coroutine.resume(screen.co)
|
coroutine.resume(screen.co)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user