Небольшая оптимизация

This commit is contained in:
Book Pauk
2019-03-18 18:40:03 +07:00
parent 8b969a6d36
commit d6e326e8be

View File

@@ -107,7 +107,7 @@ class BookManager {
} }
if (size > maxDataSize && toDel) { if (size > maxDataSize && toDel) {
await this.delBook(toDel); await this._delBook(toDel);
} else { } else {
break; break;
} }
@@ -189,15 +189,19 @@ class BookManager {
return result; return result;
} }
async delBook(meta) { async _delBook(meta) {
if (!this.books)
await this.init();
await bmMetaStore.removeItem(`bmMeta-${meta.key}`); await bmMetaStore.removeItem(`bmMeta-${meta.key}`);
await bmDataStore.removeItem(`bmData-${meta.key}`); await bmDataStore.removeItem(`bmData-${meta.key}`);
delete this.books[meta.key]; delete this.books[meta.key];
delete this.booksCached[meta.key]; delete this.booksCached[meta.key];
}
async delBook(meta) {
if (!this.books)
await this.init();
await this._delBook(meta);
await bmCacheStore.setItem('books', this.booksCached); await bmCacheStore.setItem('books', this.booksCached);
} }