Небольшая оптимизация
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user