3
0
mirror of https://github.com/britzl/monarch.git synced 2025-06-27 02:17:53 +02:00

Added option to change timestep for screen when below popup

Fixes #73
This commit is contained in:
Björn Ritzl 2021-09-19 23:08:31 +02:00
parent e26da2c6c5
commit 387a1805eb
2 changed files with 21 additions and 0 deletions

View File

@ -149,6 +149,14 @@ Check if a Monarch screen is visible.
* `exists` (boolean) - True if the screen is visible.
## monarch.set_timestep_below_popup(screen_id, timestep)
Set the timestep to apply for a screen when below a popup.
**PARAMETERS**
* `screen_id` (string|hash) - Id of the screen to change timestep setting for
* `timestep` (number) - Timestep to apply
## monarch.add_listener([url])
Add a URL that will be notified of navigation events.

View File

@ -1155,6 +1155,19 @@ function M.bottom(offset)
return screen and screen.id
end
--- Set the timestep to apply for a screen when below a popup
-- @param id (string|hash) Id of the screen to change timestep setting for
-- @param timestep (number) Timestep to apply
function M.set_timestep_below_popup(id, timestep)
assert(id, "You must provide a screen id")
assert(timestep, "You must provide a timestep")
id = tohash(id)
assert(screens[id], ("There is no screen registered with id %s"):format(tostring(id)))
screens[id].timestep_below_popup = timestep
end
local function url_to_key(url)
return (url.socket or hash("")) .. (url.path or hash("")) .. (url.fragment or hash(""))
end