mirror of
https://github.com/edward-shen/MMM-pages.git
synced 2024-12-22 00:35:09 -08:00
Fixed readme, added NaN check
This commit is contained in:
parent
6ea3f13e7d
commit
614f6b9606
2 changed files with 4 additions and 4 deletions
|
@ -72,7 +72,7 @@ Module.register('MMM-pages', {
|
|||
break;
|
||||
case 'PAGE_DECREMENT':
|
||||
Log.log('[Pages]: received a notification to decrement pages!');
|
||||
this.changePageBy(payload, -1);
|
||||
this.changePageBy(-payload, -1);
|
||||
this.updatePages();
|
||||
break;
|
||||
case 'DOM_OBJECTS_CREATED':
|
||||
|
@ -104,7 +104,7 @@ Module.register('MMM-pages', {
|
|||
Log.warn(`[Pages]: ${amt} is not a number!`);
|
||||
}
|
||||
|
||||
if (typeof amt === 'number') {
|
||||
if (typeof amt === 'number' && !isNaN(amt)) {
|
||||
this.curPage = this.mod(
|
||||
this.curPage + amt,
|
||||
this.config.modules.length
|
||||
|
|
|
@ -77,8 +77,8 @@ this.sendNotification("PAGE_CHANGED", 2);
|
|||
This would cause the module to change show that you are on page 3.
|
||||
|
||||
You can also just send `PAGE_INCREMENT` or `PAGE_DECREMENT` without any payloads
|
||||
(or with, but it will be ignored) to have the module change the displayed page
|
||||
by one.
|
||||
to have the module change the displayed page by one. If you attach a payload to
|
||||
these commands, it will attempt to the nth next page or nth previous page.
|
||||
|
||||
This module keeps internal track of how many pages you have, defined by your
|
||||
config in the config file. There is no way to dynamically change the pages you
|
||||
|
|
Loading…
Reference in a new issue