Add preload lookahead controller

This commit is contained in:
Leeingnyo
2021-08-18 22:00:39 +09:00
parent b02b28d3e3
commit d544252e3e
2 changed files with 12 additions and 1 deletions

View File

@@ -55,7 +55,7 @@ const readerComponent = () => {
}
// Preload Images
this.preloadLookahead = 3;
this.preloadLookahead = +localStorage.getItem('preloadLookahead') ?? 3;
const limit = Math.min(page + this.preloadLookahead, this.items.length + 1);
for (let idx = page + 1; idx <= limit; idx++) {
this.preloadImage(this.items[idx - 1].url);
@@ -305,6 +305,10 @@ const readerComponent = () => {
marginChanged() {
localStorage.setItem('margin', this.margin);
this.toPage(this.selectedIndex);
},
preloadLookaheadChanged() {
localStorage.setItem('preloadLookahead', this.preloadLookahead);
}
};
}