Răsfoiți Sursa

Мелкий рефакторинг

Book Pauk 6 ani în urmă
părinte
comite
b1937eb8c0
1 a modificat fișierele cu 19 adăugiri și 21 ștergeri
  1. 19 21
      client/components/Reader/Reader.vue

+ 19 - 21
client/components/Reader/Reader.vue

@@ -314,30 +314,28 @@ class Reader extends Vue {
                 this.$refs.historyPage.updateTableData();
             }
 
-            (async() => {
-                const oldBook = this.mostRecentBookReactive;
-                const newBook = bookManager.mostRecentBook();
-
-                if (oldBook && newBook) {
-                    if (oldBook.key != newBook.key) {
-                        this.loadingBook = true;
-                        try {
-                            await this.loadBook(newBook);
-                        } finally {
-                            this.loadingBook = false;
-                        }
-                    } else if (oldBook.bookPos != newBook.bookPos) {
-                        while (this.loadingBook) await utils.sleep(100);
-                        this.bookPosChanged({bookPos: newBook.bookPos});
+            const oldBook = this.mostRecentBookReactive;
+            const newBook = bookManager.mostRecentBook();
+
+            if (oldBook && newBook) {
+                if (oldBook.key != newBook.key) {
+                    this.loadingBook = true;
+                    try {
+                        await this.loadBook(newBook);
+                    } finally {
+                        this.loadingBook = false;
                     }
+                } else if (oldBook.bookPos != newBook.bookPos) {
+                    while (this.loadingBook) await utils.sleep(100);
+                    this.bookPosChanged({bookPos: newBook.bookPos});
                 }
+            }
 
-                if (eventName == 'recent-changed') {
-                    this.debouncedSaveRecentLast();
-                } else {
-                    this.debouncedSaveRecent();
-                }
-            })();
+            if (eventName == 'recent-changed') {
+                this.debouncedSaveRecentLast();
+            } else {
+                this.debouncedSaveRecent();
+            }
         }
     }