update readme, changed initial notification to NEW_PAGE

This commit is contained in:
Edward Shen 2020-09-07 16:09:37 -04:00
parent 87f6b1eba1
commit 8e57458b72
Signed by: edward
GPG key ID: F350507060ED6C90
2 changed files with 13 additions and 2 deletions

View file

@ -99,7 +99,7 @@ Module.register('MMM-pages', {
Log.log('[Pages]: received that all objects are created;'
+ 'will now hide things!');
this.sendNotification('MAX_PAGES_CHANGED', this.config.modules.length);
this.sendNotification('PAGE_CHANGED', this.curPage);
this.sendNotification('NEW_PAGE', this.curPage);
this.animatePageChange();
this.resetTimerWithDelay(0);
break;

View file

@ -65,7 +65,7 @@ For the `module` configuration option, the first element of the outer array
should consist of elements that should be on the first page. The second element
should consist of elements that should be on the second page, and so forth.
## Regarding notifications
## Notifications
This module responds to the notification `PAGE_CHANGED`. The payload should be
an `integer`. Note that this has strict error checking, so `"3"` will not work,
@ -106,6 +106,17 @@ you can send a `RESUME_ROTATION` event to resume it.
If you want to return to the home page, simply send a `HOME_PAGE` notification.
### Initialization
_This section provides documentation on what notifications the module sends on
startup. This section isn't necessary to read for most users._
MMM-pages doesn't activate until we receive the `DOM_OBJECTS_CREATED`
notification, as that notification ensures all modules have been loaded. On this
notification, we send two notifications out, `MAX_PAGES_CHANGED` and `NEW_PAGE`,
so other modules that would like to keep synchronized of the starting page and
max pages have a way to determine which page to start on.
## FAQ
- Help! My module is (above/below) another module in the same region but I want