mirror of
https://github.com/britzl/monarch.git
synced 2025-06-27 02:17:53 +02:00
53 lines
1.9 KiB
Plaintext
53 lines
1.9 KiB
Plaintext
local monarch
|
|
|
|
go.property("screen_proxy", msg.url("#collectionproxy"))
|
|
go.property("screen_id", hash("UNIQUE ID HERE"))
|
|
go.property("popup", false)
|
|
go.property("popup_on_popup", false)
|
|
go.property("timestep_below_popup", 1)
|
|
go.property("screen_keeps_input_focus_when_below_popup", false)
|
|
go.property("others_keep_input_focus_when_below_screen", false)
|
|
go.property("transition_url", msg.url("__DEPRECATED__"))
|
|
go.property("focus_url", msg.url("__DEPRECATED__"))
|
|
go.property("receiver_url", msg.url("__DEPRECATED__"))
|
|
go.property("preload", false)
|
|
|
|
|
|
function init(self)
|
|
monarch = require "monarch.monarch"
|
|
local url = msg.url()
|
|
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_proxy ~= url, "You must specify either a proxy URL")
|
|
assert(self.timestep_below_popup >= 0, "Timestep must be positive")
|
|
|
|
local settings = {
|
|
popup = self.popup,
|
|
popup_on_popup = self.popup_on_popup,
|
|
transition_url = self.transition_url ~= url and self.transition_url or nil,
|
|
focus_url = self.focus_url ~= url and self.focus_url or nil,
|
|
receiver_url = self.receiver_url ~= url and self.receiver_url or nil,
|
|
timestep_below_popup = self.timestep_below_popup,
|
|
screen_keeps_input_focus_when_below_popup = self.screen_keeps_input_focus_when_below_popup,
|
|
others_keep_input_focus_when_below_screen = self.others_keep_input_focus_when_below_screen,
|
|
auto_preload = self.preload,
|
|
}
|
|
|
|
monarch.register_proxy(self.screen_id, self.screen_proxy, 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
|