Поправка бага
This commit is contained in:
@@ -6,14 +6,17 @@ import BookParser from './BookParser';
|
|||||||
|
|
||||||
const maxDataSize = 300*1024*1024;//compressed bytes
|
const maxDataSize = 300*1024*1024;//compressed bytes
|
||||||
|
|
||||||
|
//локальный кэш метаданных книг, ограничение maxDataSize
|
||||||
const bmMetaStore = localForage.createInstance({
|
const bmMetaStore = localForage.createInstance({
|
||||||
name: 'bmMetaStore'
|
name: 'bmMetaStore'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//локальный кэш самих книг, ограничение maxDataSize
|
||||||
const bmDataStore = localForage.createInstance({
|
const bmDataStore = localForage.createInstance({
|
||||||
name: 'bmDataStore'
|
name: 'bmDataStore'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//список недавно открытых книг
|
||||||
const bmRecentStore = localForage.createInstance({
|
const bmRecentStore = localForage.createInstance({
|
||||||
name: 'bmRecentStore'
|
name: 'bmRecentStore'
|
||||||
});
|
});
|
||||||
@@ -238,7 +241,7 @@ class BookManager {
|
|||||||
let book = this.books[meta.key];
|
let book = this.books[meta.key];
|
||||||
|
|
||||||
if (!book && !this.loaded) {
|
if (!book && !this.loaded) {
|
||||||
book = await bmDataStore.getItem(`bmMeta-${meta.key}`);
|
book = await bmMetaStore.getItem(`bmMeta-${meta.key}`);
|
||||||
if (book)
|
if (book)
|
||||||
this.books[meta.key] = book;
|
this.books[meta.key] = book;
|
||||||
}
|
}
|
||||||
@@ -254,7 +257,7 @@ class BookManager {
|
|||||||
result = this.books[meta.key];
|
result = this.books[meta.key];
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
result = await bmDataStore.getItem(`bmMeta-${meta.key}`);
|
result = await bmMetaStore.getItem(`bmMeta-${meta.key}`);
|
||||||
if (result)
|
if (result)
|
||||||
this.books[meta.key] = result;
|
this.books[meta.key] = result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user