mirror of
https://github.com/edward-shen/MMM-pages.git
synced 2024-11-22 02:04:29 -08:00
Reintroduced self
for compatability.
This commit is contained in:
parent
9c33755a85
commit
1425b70ad6
1 changed files with 16 additions and 12 deletions
28
MMM-pages.js
28
MMM-pages.js
|
@ -93,6 +93,10 @@ Module.register('MMM-pages', {
|
||||||
*/
|
*/
|
||||||
updatePages(manuallyCalled) {
|
updatePages(manuallyCalled) {
|
||||||
if (this.config.modules.length !== 0) {
|
if (this.config.modules.length !== 0) {
|
||||||
|
// We need to use self because upstream uses an older electron and thus
|
||||||
|
// older version of node
|
||||||
|
const self = this;
|
||||||
|
|
||||||
Log.log(`updatePages was ${manuallyCalled ? '' : 'not'} manually called`);
|
Log.log(`updatePages was ${manuallyCalled ? '' : 'not'} manually called`);
|
||||||
|
|
||||||
// Hides the current page's elements.
|
// Hides the current page's elements.
|
||||||
|
@ -101,19 +105,19 @@ Module.register('MMM-pages', {
|
||||||
.exceptWithClass(this.config.modules[this.curPage])
|
.exceptWithClass(this.config.modules[this.curPage])
|
||||||
.enumerate((module) => {
|
.enumerate((module) => {
|
||||||
module.hide(
|
module.hide(
|
||||||
this.config.animationTime / 2,
|
self.config.animationTime / 2,
|
||||||
{ lockString: this.identifier },
|
{ lockString: self.identifier },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Shows the next page's elements
|
// Shows the next page's elements
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
MM.getModules()
|
MM.getModules()
|
||||||
.withClass(this.config.modules[this.curPage])
|
.withClass(self.config.modules[self.curPage])
|
||||||
.enumerate((module) => {
|
.enumerate((module) => {
|
||||||
module.show(
|
module.show(
|
||||||
this.config.animationTime / 2,
|
self.config.animationTime / 2,
|
||||||
{ lockString: this.identifier },
|
{ lockString: self.identifier },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}, this.config.animationTime / 2);
|
}, this.config.animationTime / 2);
|
||||||
|
@ -124,15 +128,15 @@ Module.register('MMM-pages', {
|
||||||
clearInterval(this.timer);
|
clearInterval(this.timer);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.timer = setInterval(() => {
|
self.timer = setInterval(() => {
|
||||||
// Incrementing page
|
// Incrementing page
|
||||||
this.curPage = this.mod(
|
self.curPage = self.mod(
|
||||||
this.curPage + 1,
|
self.curPage + 1,
|
||||||
this.config.modules.length,
|
self.config.modules.length,
|
||||||
);
|
);
|
||||||
this.sendNotification('PAGE_INCREMENT');
|
self.sendNotification('PAGE_INCREMENT');
|
||||||
this.updatePages(false);
|
self.updatePages(false);
|
||||||
}, this.config.rotationTime, false);
|
}, self.config.rotationTime, false);
|
||||||
}, this.config.rotationDelay);
|
}, this.config.rotationDelay);
|
||||||
}
|
}
|
||||||
} else { Log.error("Pages aren't properly defined!"); }
|
} else { Log.error("Pages aren't properly defined!"); }
|
||||||
|
|
Loading…
Reference in a new issue