mirror of
https://github.com/britzl/monarch.git
synced 2025-06-27 18:37:46 +02:00
41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
local monarch = require "monarch.monarch"
|
|
|
|
go.property("screen_proxy", msg.url("#collectionproxy"))
|
|
go.property("screen_id", hash(""))
|
|
go.property("popup", false)
|
|
go.property("transition_show_in", msg.url())
|
|
go.property("transition_show_out", msg.url())
|
|
go.property("transition_back_in", msg.url())
|
|
go.property("transition_back_out", msg.url())
|
|
|
|
|
|
function init(self)
|
|
monarch.register(self.screen_id, self.screen_proxy, self.popup, {
|
|
show_in = self.transition_show_in,
|
|
show_out = self.transition_show_out,
|
|
back_in = self.transition_back_in,
|
|
back_out = self.transition_back_out,
|
|
})
|
|
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 == hash("transition_show_in")
|
|
or message_id == hash("transition_show_out")
|
|
or message_id == hash("transition_back_in")
|
|
or message_id == hash("transition_back_out") then
|
|
msg.post(sender, "transition_done")
|
|
else
|
|
monarch.on_message(message_id, message, sender)
|
|
end
|
|
end
|