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

Added keep_loaded option to preload()

Fixes #88
This commit is contained in:
Björn Ritzl
2022-07-04 22:43:25 +02:00
parent bcc6264cd4
commit c0d45c3d5c
3 changed files with 33 additions and 3 deletions

View File

@@ -48,13 +48,18 @@ Go back to a previous Monarch screen. This operation will be added to the queue
* `callback` (function) - Optional function to call when the previous screen is visible.
## monarch.preload(screen_id, [callback])
## monarch.preload(screen_id, [options], [callback])
Preload a Monarch screen. This will load but not enable the screen. This is useful for content heavy screens that you wish to be able to show without having to wait for it load. This operation will be added to the queue if Monarch is busy.
**PARAMETERS**
* `screen_id` (string|hash) - Id of the screen to preload.
* `options` (table)
* `callback` (function) - Optional function to call when the screen is preloaded.
The options table can contain the following fields:
* `keep_loaded` (boolean) - If the `keep_loaded` flag is set Monarch will keep the screen preloaded even after a `hide()` or `back()` navigation event that normally would unload the screen.
## monarch.is_preloading(screen_id)
Check if a Monarch screen is preloading (via monarch.preload() or the Preload screen setting).