mirror of
https://github.com/britzl/monarch.git
synced 2025-11-27 11:20:55 +01:00
Initial commit
This commit is contained in:
46
monarch/screen.script
Normal file
46
monarch/screen.script
Normal file
@@ -0,0 +1,46 @@
|
||||
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)
|
||||
print("screen init", self.proxy)
|
||||
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)
|
||||
print("screen final", self.proxy)
|
||||
monarch.unregister(self.screen_id)
|
||||
end
|
||||
|
||||
function on_message(self, message_id, message, sender)
|
||||
print("screen on_message", message_id, sender)
|
||||
if message_id == hash("show") then
|
||||
monarch.show(self.screen_id, message.clear)
|
||||
elseif message_id == hash("hide") then
|
||||
monarch.hide(self.screen_id)
|
||||
elseif message_id == hash("back") then
|
||||
monarch.hide(self.screen_id)
|
||||
elseif message_id == hash("transition_show_in") then
|
||||
msg.post(sender, "transition_done")
|
||||
elseif message_id == hash("transition_show_out") then
|
||||
msg.post(sender, "transition_done")
|
||||
elseif message_id == hash("transition_back_in") then
|
||||
msg.post(sender, "transition_done")
|
||||
elseif message_id == hash("transition_back_out") then
|
||||
msg.post(sender, "transition_done")
|
||||
else
|
||||
monarch.on_message(message_id, message, sender)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user