3
0
mirror of https://github.com/britzl/monarch.git synced 2025-09-27 18:12:22 +02:00

Preload fix (#34)

* Don't try to preload if monarch is busy
* Added test for #32
This commit is contained in:
Björn Ritzl
2018-12-10 12:27:11 +01:00
committed by GitHub
parent 8a0a36a2d5
commit 753d003861
2 changed files with 13 additions and 0 deletions

View File

@@ -621,6 +621,11 @@ end
-- @param id (string|hash) - Id of the screen to preload
-- @param cb (function) - Optional callback to invoke when screen is loaded
function M.preload(id, cb)
if M.is_busy() then
log("preload() monarch is busy, ignoring request")
return false
end
assert(id, "You must provide a screen id")
id = tohash(id)
assert(screens[id], ("There is no screen registered with id %s"):format(tostring(id)))