Implemented notification on every page change.

Fixes #29.
This commit is contained in:
Edward Shen 2020-04-07 11:52:39 -04:00
parent 22a1e543b6
commit c017c9f4ab
Signed by: edward
GPG key ID: 19182661E818369F
2 changed files with 15 additions and 10 deletions

View file

@ -135,6 +135,7 @@ Module.register('MMM-pages', {
if (this.config.modules.length !== 0) { if (this.config.modules.length !== 0) {
this.animatePageChange(); this.animatePageChange();
this.resetTimerWithDelay(this.config.rotationDelay); this.resetTimerWithDelay(this.config.rotationDelay);
this.sendNotification('NEW_PAGE', this.curPage);
} else { Log.error("[Pages]: Pages aren't properly defined!"); } } else { Log.error("[Pages]: Pages aren't properly defined!"); }
}, },

View file

@ -91,10 +91,14 @@ enforce what page other modules should indicate. This is intentional, because
any other module that needs a page change notification should be receiving from any other module that needs a page change notification should be receiving from
the notification system. the notification system.
Finally, if you want to know what page you're currently on, send a `QUERY_PAGE_NUMBER` If you want to know what page you're currently on, send a `QUERY_PAGE_NUMBER`
notification. The module will respond with a `PAGE_NUMBER_IS` notification, notification. The module will respond with a `PAGE_NUMBER_IS` notification,
with the payload of the current page number. with the payload of the current page number.
This module also sends a `NEW_PAGE` notification on every page update. The
payload is identical to as if one sent a `QUERY_PAGE_NUMBER` notification. A
separate notification tag is used for compatibility reasons.
## FAQ ## FAQ
- Help! My module is (above/below) another module in the same region but I want - Help! My module is (above/below) another module in the same region but I want