mirror of
https://github.com/edward-shen/MMM-pages.git
synced 2025-04-19 03:38:19 -07:00
Ability to return to the first page without the loop function
This commit is contained in:
parent
bd8cc9f332
commit
b0b07cf2f4
1 changed files with 17 additions and 1 deletions
18
MMM-pages.js
18
MMM-pages.js
|
@ -14,6 +14,7 @@ Module.register('MMM-pages', {
|
|||
fixed: ['MMM-page-indicator'],
|
||||
animationTime: 1000,
|
||||
rotationTime: 0,
|
||||
rotationFirstpage:0,
|
||||
rotationDelay: 10000
|
||||
},
|
||||
|
||||
|
@ -52,6 +53,7 @@ Module.register('MMM-pages', {
|
|||
// Disable rotation if an invalid input is given
|
||||
this.config.rotationTime = Math.max(this.config.rotationTime, 0);
|
||||
this.config.rotationDelay = Math.max(this.config.rotationDelay, 0);
|
||||
this.config.rotationFirstpage = Math.max(this.config.rotationFirstpage, 0);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -212,6 +214,20 @@ Module.register('MMM-pages', {
|
|||
self.updatePages();
|
||||
}, self.config.rotationTime);
|
||||
}, delay);
|
||||
}
|
||||
}if (this.config.rotationFirstpage > 0) {
|
||||
// This timer is the auto rotate function.
|
||||
clearInterval(this.timer);
|
||||
// This is delay timer after manually updating.
|
||||
clearInterval(this.delayTimer);
|
||||
const self = this;
|
||||
|
||||
this.delayTimer = setTimeout(() => {
|
||||
self.timer = setInterval(() => {
|
||||
self.sendNotification('PAGE_CHANGED', 0);
|
||||
self.changePageBy(-this.curPage);
|
||||
self.updatePages();
|
||||
}, self.config.rotationFirstpage);
|
||||
}, delay);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue