From 086c353eff799483bd1d5ffced05643e6efa75e1 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Fri, 23 Aug 2019 13:32:18 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B1=D0=B0=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/share/bookManager.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/components/Reader/share/bookManager.js b/client/components/Reader/share/bookManager.js index 496e8c80..a4fc8f63 100644 --- a/client/components/Reader/share/bookManager.js +++ b/client/components/Reader/share/bookManager.js @@ -377,7 +377,8 @@ class BookManager { this.sortedRecentCached = null; - this.emit('recent-changed'); + if (isDel) + this.emit('recent-changed'); return isDel; } @@ -385,6 +386,7 @@ class BookManager { if (this.recentLast) { return this.recentLast; } + const oldRecentLast = this.recentLast; let max = 0; let result = null; @@ -398,7 +400,8 @@ class BookManager { this.recentLast = result; bmRecentStore.setItem('recent-last', this.recentLast);//no await - this.emit('recent-changed'); + if (this.recentLast !== oldRecentLast) + this.emit('recent-changed'); return result; } @@ -431,8 +434,10 @@ class BookManager { if (this.eventListeners) { (async() => { await utils.sleep(1); - for (const listener of this.eventListeners) + for (const listener of this.eventListeners) { + //console.log(eventName); listener(eventName, value); + } })(); } }