Reintroduced self for compatability.

This commit is contained in:
Edward Shen 2018-05-05 22:19:51 -04:00
parent 9c33755a85
commit 1425b70ad6
No known key found for this signature in database
GPG key ID: 4E887A42793D0433

View file

@ -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!"); }