summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-09-13 15:41:06 -0700
committerAlex Yatskov <alex@foosoft.net>2017-09-13 15:41:06 -0700
commit219eeb6e81aba136af109770974f42b703bdae60 (patch)
tree200e97d6adecb4ec2355a0f5cc299c411d4fb8c6
parent79b99131f69ab778e4c8203caa0894e8accde436 (diff)
cleanup
-rw-r--r--ext/bg/js/database.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 1760a70a..cd53f681 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -20,7 +20,6 @@
class Database {
constructor() {
this.db = null;
- this.version = 2;
this.tagCache = {};
}
@@ -177,7 +176,7 @@ class Database {
const indexDataLoaded = async summary => {
const count = await this.db.dictionaries.where('title').equals(summary.title).count();
if (count > 0) {
- throw `dictionary "${title}" is already imported`;
+ throw `dictionary "${summary.title}" is already imported`;
}
await this.db.dictionaries.add(summary);
@@ -299,9 +298,9 @@ class Database {
kanjiFreqDataLoaded,
tagDataLoaded
) {
- const files = (await JSZip.loadAsync(archive)).files;
+ const zip = await JSZip.loadAsync(archive);
- const indexFile = files['index.json'];
+ const indexFile = zip.files['index.json'];
if (!indexFile) {
throw 'no dictionary index found in archive';
}
@@ -324,7 +323,7 @@ class Database {
const countBanks = namer => {
let count = 0;
- while (files[namer(count)]) {
+ while (zip.files[namer(count)]) {
++count;
}
@@ -358,7 +357,7 @@ class Database {
const loadBank = async (namer, count, callback) => {
if (callback) {
for (let i = 0; i < count; ++i) {
- const bankFile = files[namer(i)];
+ const bankFile = zip.files[namer(i)];
const bank = JSON.parse(await bankFile.async('string'));
await callback(index.title, bank, bankTotalCount, bankLoadedCount++);
}