Добавление событий, рефакторинг
This commit is contained in:
@@ -207,6 +207,7 @@ class Reader extends Vue {
|
||||
mounted() {
|
||||
(async() => {
|
||||
await bookManager.init(this.settings);
|
||||
bookManager.addEventListener(this.bookManagerEvent);
|
||||
await this.$refs.serverStorage.init();
|
||||
|
||||
if (this.$root.rootRoute == '/reader') {
|
||||
@@ -288,6 +289,17 @@ class Reader extends Vue {
|
||||
this.debouncedUpdateRoute();
|
||||
}
|
||||
|
||||
bookManagerEvent(eventName) {
|
||||
if (eventName == 'recent-changed') {
|
||||
const oldBook = this.mostRecentBookReactive;
|
||||
const newBook = bookManager.mostRecentBook();
|
||||
|
||||
if (oldBook && newBook && oldBook.key != newBook.key) {
|
||||
this.loadBook(newBook);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get toolBarActive() {
|
||||
return this.reader.toolBarActive;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user