Увеличил количество хранимых недавних до 1000
This commit is contained in:
@@ -126,8 +126,10 @@ class HistoryPage extends Vue {
|
|||||||
updateTableData() {
|
updateTableData() {
|
||||||
let result = [];
|
let result = [];
|
||||||
|
|
||||||
for (let bookKey in bookManager.recent) {
|
const sorted = bookManager.getSortedRecent();
|
||||||
const book = bookManager.recent[bookKey];
|
const len = (sorted.length < 100 ? sorted.length : 100);
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
const book = sorted[i];
|
||||||
let d = new Date();
|
let d = new Date();
|
||||||
d.setTime(book.touchTime);
|
d.setTime(book.touchTime);
|
||||||
const t = formatDate(d).split(' ');
|
const t = formatDate(d).split(' ');
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class BookManager {
|
|||||||
if (!this.recent)
|
if (!this.recent)
|
||||||
await this.init();
|
await this.init();
|
||||||
|
|
||||||
if (Object.keys(this.recent).length > 100) {
|
if (Object.keys(this.recent).length > 1000) {
|
||||||
let min = Date.now();
|
let min = Date.now();
|
||||||
let found = null;
|
let found = null;
|
||||||
for (let key in this.recent) {
|
for (let key in this.recent) {
|
||||||
@@ -230,6 +230,20 @@ class BookManager {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSortedRecent() {
|
||||||
|
if (!this.recentChanged && this.sortedRecentCached) {
|
||||||
|
return this.sortedRecentCached;
|
||||||
|
}
|
||||||
|
|
||||||
|
let result = Object.values(this.recent);
|
||||||
|
|
||||||
|
result.sort((a, b) => b.touchTime - a.touchTime);
|
||||||
|
|
||||||
|
this.sortedRecentCached = result;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new BookManager();
|
export default new BookManager();
|
||||||
Reference in New Issue
Block a user