mirror of
https://github.com/britzl/monarch.git
synced 2025-06-27 10:27:49 +02:00
35 lines
1007 B
Plaintext
35 lines
1007 B
Plaintext
local monarch
|
|
|
|
go.property("screen_proxy", msg.url("#collectionproxy"))
|
|
go.property("screen_id", hash(""))
|
|
go.property("popup", false)
|
|
go.property("transition_url", msg.url())
|
|
go.property("focus_url", msg.url())
|
|
|
|
|
|
function init(self)
|
|
monarch = require "monarch.monarch"
|
|
monarch.register(self.screen_id, self.screen_proxy, self.popup, self.transition_url, self.focus_url)
|
|
end
|
|
|
|
function final(self)
|
|
monarch.unregister(self.screen_id)
|
|
end
|
|
|
|
function on_message(self, message_id, message, sender)
|
|
if message_id == hash("show") then
|
|
monarch.show(self.screen_id, { clear = message.clear })
|
|
elseif message_id == hash("hide") then
|
|
monarch.back()
|
|
elseif message_id == hash("back") then
|
|
monarch.back()
|
|
elseif message_id == monarch.TRANSITION.SHOW_IN
|
|
or message_id == monarch.TRANSITION.SHOW_OUT
|
|
or message_id == monarch.TRANSITION.BACK_IN
|
|
or message_id == monarch.TRANSITION.BACK_OUT then
|
|
msg.post(sender, monarch.TRANSITION.DONE)
|
|
else
|
|
monarch.on_message(message_id, message, sender)
|
|
end
|
|
end
|