aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-07-30 17:40:34 -0700
committerAlex Yatskov <alex@foosoft.net>2017-07-30 17:40:34 -0700
commit3475150b2d1424d43f5be6fcfbdbb719a576866f (patch)
tree0b1d1325dc7a5b4cd2de138c8f961b6ba2a732dc /ext/bg/js
parent817dfc25f2954680bfaa671b227d7b4caf4132ab (diff)
parent9be66c7e7bb8599cabab33f1dcd4843ef32b9b14 (diff)
Merge branch 'master' of https://github.com/FooSoft/yomichan
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/database.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 70aeb0d7..4829356c 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -189,20 +189,19 @@ class Database {
};
const termsLoaded = (title, entries, total, current) => {
- const rows = [];
- for (const [expression, reading, tags, rules, score, ...glossary] of entries) {
- rows.push({
- expression,
- reading,
- tags,
- rules,
- score,
- glossary,
- dictionary: title
- });
- }
-
- return this.db.terms.bulkAdd(rows).then(() => {
+ return this.db.transaction('rw', this.db.terms, function() {
+ for (const [expression, reading, tags, rules, score, ...glossary] of entries) {
+ this.db.terms.add({
+ expression,
+ reading,
+ tags,
+ rules,
+ score,
+ glossary,
+ dictionary: title
+ });
+ }
+ }).then(() => {
if (callback) {
callback(total, current);
}