Мелкий рефакторинг
This commit is contained in:
@@ -314,30 +314,28 @@ class Reader extends Vue {
|
|||||||
this.$refs.historyPage.updateTableData();
|
this.$refs.historyPage.updateTableData();
|
||||||
}
|
}
|
||||||
|
|
||||||
(async() => {
|
const oldBook = this.mostRecentBookReactive;
|
||||||
const oldBook = this.mostRecentBookReactive;
|
const newBook = bookManager.mostRecentBook();
|
||||||
const newBook = bookManager.mostRecentBook();
|
|
||||||
|
|
||||||
if (oldBook && newBook) {
|
if (oldBook && newBook) {
|
||||||
if (oldBook.key != newBook.key) {
|
if (oldBook.key != newBook.key) {
|
||||||
this.loadingBook = true;
|
this.loadingBook = true;
|
||||||
try {
|
try {
|
||||||
await this.loadBook(newBook);
|
await this.loadBook(newBook);
|
||||||
} finally {
|
} finally {
|
||||||
this.loadingBook = false;
|
this.loadingBook = false;
|
||||||
}
|
|
||||||
} else if (oldBook.bookPos != newBook.bookPos) {
|
|
||||||
while (this.loadingBook) await utils.sleep(100);
|
|
||||||
this.bookPosChanged({bookPos: newBook.bookPos});
|
|
||||||
}
|
}
|
||||||
|
} else if (oldBook.bookPos != newBook.bookPos) {
|
||||||
|
while (this.loadingBook) await utils.sleep(100);
|
||||||
|
this.bookPosChanged({bookPos: newBook.bookPos});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (eventName == 'recent-changed') {
|
if (eventName == 'recent-changed') {
|
||||||
this.debouncedSaveRecentLast();
|
this.debouncedSaveRecentLast();
|
||||||
} else {
|
} else {
|
||||||
this.debouncedSaveRecent();
|
this.debouncedSaveRecent();
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user