mirror of
https://github.com/edward-shen/MMM-pages.git
synced 2024-11-22 02:04:29 -08:00
For some reason it looks like node fixed the scoping of this
.
Removed instances of `self`.
This commit is contained in:
parent
00b7d6d7b9
commit
4401cb411b
1 changed files with 8 additions and 10 deletions
18
MMM-pages.js
18
MMM-pages.js
|
@ -72,7 +72,7 @@ Module.register('MMM-pages', {
|
||||||
break;
|
break;
|
||||||
case 'PAGE_DECREMENT':
|
case 'PAGE_DECREMENT':
|
||||||
Log.log(`${this.name} recieved a notification to decrement pages!`);
|
Log.log(`${this.name} recieved a notification to decrement pages!`);
|
||||||
this.curPage = this.mode(this.curPage - 1, this.config.modules.length);
|
this.curPage = this.mod(this.curPage - 1, this.config.modules.length);
|
||||||
this.updatePages(true);
|
this.updatePages(true);
|
||||||
break;
|
break;
|
||||||
case 'DOM_OBJECTS_CREATED':
|
case 'DOM_OBJECTS_CREATED':
|
||||||
|
@ -94,7 +94,6 @@ Module.register('MMM-pages', {
|
||||||
updatePages(manuallyCalled) {
|
updatePages(manuallyCalled) {
|
||||||
if (this.config.modules.length !== 0) {
|
if (this.config.modules.length !== 0) {
|
||||||
Log.log(`updatePages was ${manuallyCalled ? '' : 'not'} manually called`);
|
Log.log(`updatePages was ${manuallyCalled ? '' : 'not'} manually called`);
|
||||||
const self = this;
|
|
||||||
|
|
||||||
// Hides the current page's elements.
|
// Hides the current page's elements.
|
||||||
MM.getModules()
|
MM.getModules()
|
||||||
|
@ -110,11 +109,11 @@ Module.register('MMM-pages', {
|
||||||
// Shows the next page's elements
|
// Shows the next page's elements
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
MM.getModules()
|
MM.getModules()
|
||||||
.withClass(self.config.modules[self.curPage])
|
.withClass(this.config.modules[this.curPage])
|
||||||
.enumerate((module) => {
|
.enumerate((module) => {
|
||||||
module.show(
|
module.show(
|
||||||
self.config.animationTime / 2,
|
this.config.animationTime / 2,
|
||||||
{ lockString: self.identifier },
|
{ lockString: this.identifier },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}, this.config.animationTime / 2);
|
}, this.config.animationTime / 2);
|
||||||
|
@ -125,18 +124,17 @@ Module.register('MMM-pages', {
|
||||||
clearInterval(this.timer);
|
clearInterval(this.timer);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
self.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
// Incrementing page
|
// Incrementing page
|
||||||
this.curPage = this.mod(
|
this.curPage = this.mod(
|
||||||
this.curPage + 1,
|
this.curPage + 1,
|
||||||
this.config.modules.length,
|
this.config.modules.length,
|
||||||
);
|
);
|
||||||
self.sendNotification('PAGE_INCREMENT');
|
this.sendNotification('PAGE_INCREMENT');
|
||||||
self.updatePages(false);
|
this.updatePages(false);
|
||||||
}, self.config.rotationTime, false);
|
}, this.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