mirror of
https://github.com/edward-shen/MMM-pages.git
synced 2024-11-21 09:44:29 -08:00
Added more debug info, added clarifying parens
This commit is contained in:
parent
92c4be1973
commit
6f3ac28e69
1 changed files with 15 additions and 5 deletions
20
MMM-pages.js
20
MMM-pages.js
|
@ -55,7 +55,11 @@ Module.register('MMM-pages', {
|
|||
* @param {string} notification the notification ID
|
||||
* @param {number} payload the page to change to
|
||||
*/
|
||||
notificationReceived: function (notification, payload) {
|
||||
notificationReceived: function(notification, payload) {
|
||||
const isValidPayload = typeof payload === 'number';
|
||||
|
||||
Log.log(`[Pages]:${payload} is a number? ${isValidPayload}`);
|
||||
Log.log(`[Pages]:${this.curPage + (isValidPayload) ? payload : 1}`);
|
||||
switch (notification) {
|
||||
case 'PAGE_CHANGED':
|
||||
Log.log(`${this.name} received a notification`
|
||||
|
@ -70,13 +74,19 @@ Module.register('MMM-pages', {
|
|||
this.updatePages(true);
|
||||
break;
|
||||
case 'PAGE_INCREMENT':
|
||||
Log.log(`${this.name} received a notification to increment pages!`);
|
||||
this.curPage = this.mod(this.curPage + 1, this.config.modules.length);
|
||||
Log.log(`${this.name} recieved a notification to increment pages!`);
|
||||
this.curPage = this.mod(
|
||||
this.curPage + ((isValidPayload) ? payload : 1),
|
||||
this.config.modules.length
|
||||
);
|
||||
this.updatePages(true);
|
||||
break;
|
||||
case 'PAGE_DECREMENT':
|
||||
Log.log(`${this.name} received a notification to decrement pages!`);
|
||||
this.curPage = this.mod(this.curPage - 1, this.config.modules.length);
|
||||
Log.log(`${this.name} recieved a notification to decrement pages!`);
|
||||
this.curPage = this.mod(
|
||||
this.curPage - ((isValidPayload) ? payload : 1),
|
||||
this.config.modules.length
|
||||
);
|
||||
this.updatePages(true);
|
||||
break;
|
||||
case 'DOM_OBJECTS_CREATED':
|
||||
|
|
Loading…
Reference in a new issue