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

Update README.md

This commit is contained in:
Björn Ritzl 2020-03-10 22:47:29 +01:00 committed by GitHub
parent c7ff068f79
commit be5a375559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,12 +77,12 @@ The navigation in Monarch is based around a stack of screens. When a screen is s
### Showing a new screen ### Showing a new screen
You show a screen in one of two ways: You show a screen in one of two ways:
1. Post a ```show``` message to the ```screen.script``` 1. Post a ```show``` message to the screen script (either `screen_proxy.script` or `screen_factory.script`)
2. Call ```monarch.show()``` (see below) 2. Call ```monarch.show()``` (see below)
Showing a screen will push it to the top of the stack and trigger an optional transition. The previous screen will be hidden (with an optional transition) unless the screen to be shown is a [popup](#popups). Showing a screen will push it to the top of the stack and trigger an optional transition. The previous screen will be hidden (with an optional transition) unless the screen to be shown is a [popup](#popups).
NOTE: You must ensure that the ```init()``` function of the ```screen.script``` has run. The ```init()``` function is responsible for registering the screen and it's not possible to show it until this has happened. A good practice is to delay the first call by posting a message to a controller script or similar before calling ```monarch.show()``` the first time: NOTE: You must ensure that the ```init()``` function of the screen script (either `screen_proxy.script` or `screen_factory.script`) has run. The ```init()``` function is responsible for registering the screen and it's not possible to show it until this has happened. A good practice is to delay the first call by posting a message to a controller script or similar before calling ```monarch.show()``` the first time:
function init(self) function init(self)
msg.post("#", "show_first_screen") msg.post("#", "show_first_screen")
@ -117,7 +117,7 @@ Monarch can also show a screen without adding it to the stack. This can be used
### Going back to a previous screen ### Going back to a previous screen
You navigate back in the screen hierarchy in one of two ways: You navigate back in the screen hierarchy in one of two ways:
1. Post a ```back``` message to the ```screen.script``` 1. Post a ```back``` message to the screen script (either `screen_proxy.script` or `screen_factory.script`)
2. Call ```monarch.back()``` (see below) 2. Call ```monarch.back()``` (see below)
@ -305,7 +305,7 @@ Both the ```monarch.show()``` and ```monarch.back()``` functions take an optiona
## Monarch API ## Monarch API
### monarch.show(screen_id, [options], [data], [callback]) ### monarch.show(screen_id, [options], [data], [callback])
Show a Monarch screen. Note that the screen must be registered before it can be shown. The ```init()``` function of the ```screen.script``` takes care of registration. This operation will be added to the queue if Monarch is busy. Show a Monarch screen. Note that the screen must be registered before it can be shown. The ```init()``` function of the screen script (either `screen_proxy.script` or `screen_factory.script`) takes care of registration. This operation will be added to the queue if Monarch is busy.
**PARAMETERS** **PARAMETERS**
* ```screen_id``` (string|hash) - Id of the screen to show. * ```screen_id``` (string|hash) - Id of the screen to show.