attempted to format to 80 characters

This commit is contained in:
Edward Shen 2018-05-07 10:50:08 -04:00
parent 888b74eae0
commit 2d0eb22a6d
No known key found for this signature in database
GPG key ID: 4E887A42793D0433

View file

@ -1,11 +1,15 @@
# MMM-pages # MMM-pages
This [MagicMirror²][mm] Module allows you to have pages in your magic mirror! Want to have more modules in your magic mirror, but want to keep the format? Or, want to have grouped modules that are themed together? Look no further! This [MagicMirror²][mm] Module allows you to have pages in your magic mirror!
Want to have more modules in your magic mirror, but want to keep the format?
Or, want to have grouped modules that are themed together? Look no further!
[Click here to see an example of it in action!](https://www.youtube.com/watch?v=1NQ-sGtdUdg) [Click here to see an example of it in action!][example_url]
Note that this module does not provide any method of manually changing the page! You should ask other developers to add a notification to their modules, or add one yourself! Note that this module does not provide any method of manually changing the page!
You should ask other developers to add a notification to their modules, or add
one yourself!
## Installation ## Installation
@ -20,9 +24,12 @@ git clone https://github.com/edward-shen/MMM-pages.git
``` ```
Configure the module in your config.js file. Configure the module in your config.js file.
\<self-promotion> *\<self-promotion>*
To display what page you're on, I'd highly recommend checking out my [page indicator module][page indicator].
\<\\self-promotion> To display what page you're on, I'd highly recommend checking out my
[page indicator module][page indicator].
*\<\\self-promotion>*
## Using the module ## Using the module
@ -43,37 +50,57 @@ modules: [
## Configuration options ## Configuration options
Option|Description Option |Type |Default Value |Description
------|----------- ---------------|-----------------------------------------------------------|------------------------|---------
`modules`|A 2D String array of what each module should be on which page. Note that all entries must take their class name (e.g. this module's class name is `MMM-pages`, while the default modules may just have `newsfeed`, without the `MMM-` prefix.<br/>**Expected Value type:** `[ [String, String, ...], [String, String, ...], ...]`. `modules` |`[ [String, String, ...],`<br>`[String, String, ...], ...]`|`[]` |A 2D String array of what each module should be on which page. Notethat all entries must take their class name (e.g. this module's class name is `MMM-pages`, while the default modules may just have `newsfeed`, without the `MMM-` prefix.
`excludes`|Which modules should show up all the time.<br/>**Expected Value type:** `[ String, String, ... ]`. `excludes` |`[ String, String, ... ]` |`["MMM-page-indicator"]`|Which modules should show up all the time.
`animationTime`|Fading animation time. Set to `0` for instant change. Value is in milliseconds (1 second = 1000 milliseconds).<br/>**Expected Value type:** `int`. `animationTime`|`int` |`1000` |Fading animation time. Set to `0` for instant change. Value is in milliseconds (1 second = 1000 milliseconds).
`rotationTime`|Time, in milliseconds, between automatic page changes.<br/>**Expected Value type:** `int`.<br/>**Default value:** `0` `rotationTime` |`int` |`0` |Time, in milliseconds, between automatic page changes.
`delayTime`|Time, in milliseconds, of how long should a manual page change linger before returning to automatic page changing. In other words, how long should the timer wait for after you manually change a page. This does include the animation time, so you may wish to increase it by a few seconds or so to account for the animation time.<br/>**Expected Value type:** `int`.<br/>**Default value:** `10000` `delayTime` |`int` |`0` |Time, in milliseconds, of how long should a manual page change linger before returning to automatic page changing. In other words, how long should the timer wait for after you manually change a page. This does include the animation time, so you may wish to increase it by a few seconds or so to account for the animation time.
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. 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 ## Regarding 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, while `3` will. Also do note that to switch to page 1, you need to send `0` to the module. **This uses a zero-based numbering system.** 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,
while `3` will. Also do note that to switch to page 1, you need to send `0` to
the module. **This uses a zero-based numbering system.**
Let's say that you want to change the indicator to page 3. In your code, you would write: Let's say that you want to change the indicator to page 3. In your code, you
would write:
```js ```js
this.sendNotification("PAGE_CHANGED", 2); this.sendNotification("PAGE_CHANGED", 2);
``` ```
This would cause the module to change show that you are on page 3. 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. 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.
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 have. If there arises a need, please create an issue. 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
have. If there arises a need, please create an issue.
This module sends one notification, `MAX_PAGES_CHANGED` to assist display modules with how many pages they should display. However, this module does not enforce what page other modules should indicate. This is intentional, because any other module that needs a page change notification should be recieving from the notification system. This module sends one notification, `MAX_PAGES_CHANGED` to assist display
modules with how many pages they should display. However, this module does not
enforce what page other modules should indicate. This is intentional, because
any other module that needs a page change notification should be recieving from
the notification system.
## FAQ ## FAQ
- Help! My module is (above/below) another module in the same region but I want it to be somewhere else! - Help! My module is (above/below) another module in the same region but I want
it to be somewhere else!
The order of your `config.js` determines your module location. If you have two modules, both with `position:bottom_bar`, the one that is first listed will appear on top. The rest will appear in the same order you defined them in. If you want this module to be at the very bottom, define this module as the last module in your `config.js` file. If you want it to be on top in that region, make sure no other module is defined before it that has the same region. The order of your `config.js` determines your module location. If you have two
modules, both with `position:bottom_bar`, the one that is first listed will
appear on top. The rest will appear in the same order you defined them in. If
you want this module to be at the very bottom, define this module as the last
module in your `config.js` file. If you want it to be on top in that region,
make sure no other module is defined before it that has the same region.
- Can I make a pull request? - Can I make a pull request?
@ -83,5 +110,6 @@ This module sends one notification, `MAX_PAGES_CHANGED` to assist display module
Please make an issue. Thanks! Please make an issue. Thanks!
[example_url]: https://www.youtube.com/watch?v=1NQ-sGtdUdg
[mm]: https://github.com/MichMich/MagicMirror [mm]: https://github.com/MichMich/MagicMirror
[page indicator]: https://github.com/edward-shen/MMM-page-indicator [page indicator]: https://github.com/edward-shen/MMM-page-indicator