mirror of
https://github.com/britzl/monarch.git
synced 2025-06-27 10:27:49 +02:00
42 lines
1.2 KiB
Plaintext
42 lines
1.2 KiB
Plaintext
local monarch
|
|
|
|
go.property("screen_factory", msg.url("#collectionfactory"))
|
|
go.property("screen_id", hash("UNIQUE ID HERE"))
|
|
go.property("popup", false)
|
|
go.property("popup_on_popup", false)
|
|
go.property("transition_id", hash(""))
|
|
go.property("focus_id", hash(""))
|
|
go.property("preload", false)
|
|
|
|
|
|
function init(self)
|
|
monarch = require "monarch.monarch"
|
|
assert(not self.popup_on_popup or (self.popup_on_popup and self.popup), "Popup on Popups can only be set if the Popup flag is set")
|
|
assert(self.screen_factory ~= msg.url(), "You must specify either a factory URL")
|
|
|
|
local settings = {
|
|
popup = self.popup,
|
|
popup_on_popup = self.popup_on_popup,
|
|
transition_id = self.transition_id,
|
|
focus_id = self.focus_id,
|
|
auto_preload = self.preload,
|
|
}
|
|
monarch.register_factory(self.screen_id, self.screen_factory, settings)
|
|
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()
|
|
else
|
|
monarch.on_message(message_id, message, sender)
|
|
end
|
|
end
|