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

Added is_preloading() and when_loaded()

This commit is contained in:
Björn Ritzl
2019-03-08 10:28:39 +01:00
parent 1bc0ae09ee
commit 57946d27bf
2 changed files with 76 additions and 4 deletions

View File

@@ -334,8 +334,26 @@ Preload a Monarch screen. This will load but not enable the screen. This is usef
* ```callback``` (function) - Optional function to call when the screen is preloaded.
### monarch.is_preloading(screen_id)
Check if a Monarch screen is preloading (via monarch.preload() or the Preload screen setting).
**PARAMETERS**
* ```screen_id``` (hash) - Id of the screen to check
**RETURN**
* ```preloading``` (boolean) - True if the screen is preloading.
### monarch.when_preloaded(screen_id, callback)
Invoke a callback when a screen has been preloaded.
**PARAMETERS**
* ```screen_id``` (hash) - Id of the screen to check
* ```callback``` (function) - Function to call when the screen has been preloaded.
### monarch.unload(screen_id, [callback])
Unload a preloaded Monarch screen. A preloaded screen will automatically get unloaded when hidden, but this function can be useful if a screen has been preloaded and it needs to be unloaded again.
Unload a preloaded Monarch screen. A preloaded screen will automatically get unloaded when hidden, but this function can be useful if a screen has been preloaded and it needs to be unloaded again without actually hiding it.
**PARAMETERS**
* ```screen_id``` (hash) - Id of the screen to unload.