Синхронизация recent, пока не оптимизировано

This commit is contained in:
Book Pauk
2019-03-22 14:14:47 +07:00
parent 79ced4eca4
commit 737ae75c28
3 changed files with 37 additions and 19 deletions

View File

@@ -294,10 +294,13 @@ class Reader extends Vue {
this.debouncedUpdateRoute();
}
bookManagerEvent(eventName) {
async bookManagerEvent(eventName) {
const serverStorage = this.$refs.serverStorage;
if (eventName == 'load-meta-finish') {
serverStorage.init();
const result = await bookManager.cleanRecentBooks();
if (result)
this.debouncedSaveRecent();
}
if (eventName == 'recent-changed') {
@@ -305,8 +308,12 @@ class Reader extends Vue {
const oldBook = this.mostRecentBookReactive;
const newBook = bookManager.mostRecentBook();
if (oldBook && newBook && oldBook.key != newBook.key) {
await this.loadBook(newBook);
if (oldBook && newBook) {
if (oldBook.key != newBook.key) {
await this.loadBook(newBook);
} else if (oldBook.bookPos != newBook.bookPos) {
this.bookPosChanged({bookPos: newBook.bookPos});
}
}
this.debouncedSaveRecent();