Небольшие поправки

This commit is contained in:
Book Pauk
2019-03-25 14:03:50 +07:00
parent 2a0d1dcfce
commit 77c68d4e11
2 changed files with 20 additions and 12 deletions

View File

@@ -79,6 +79,8 @@ class BookManager {
} }
} }
//"ленивая" загрузка
(async() => {
let key = null; let key = null;
len = await bmRecentStore.length(); len = await bmRecentStore.length();
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
@@ -92,6 +94,7 @@ class BookManager {
await bmRecentStore.removeItem(key); await bmRecentStore.removeItem(key);
} }
} }
})();
//размножение для дебага //размножение для дебага
/*if (key) { /*if (key) {
@@ -410,6 +413,11 @@ class BookManager {
this.recentLast = value; this.recentLast = value;
await bmCacheStore.setItem('recent-last', this.recentLast); await bmCacheStore.setItem('recent-last', this.recentLast);
if (value && value.key) { if (value && value.key) {
//гарантия переключения книги
const mostRecent = this.mostRecentBook();
if (mostRecent)
this.recent[mostRecent.key].touchTime = value.touchTime - 1;
this.recent[value.key] = value; this.recent[value.key] = value;
await bmRecentStore.setItem(value.key, value); await bmRecentStore.setItem(value.key, value);
await bmCacheStore.setItem('recent', this.recent); await bmCacheStore.setItem('recent', this.recent);