Dexie fixes

This commit is contained in:
Alex Yatskov 2016-11-07 08:21:49 -08:00
parent ed2091ae1b
commit 8c22f53f3e
3 changed files with 12 additions and 15 deletions

View File

@ -20,7 +20,7 @@
class Dictionary {
constructor() {
this.db = null;
this.dbVer = 5;
this.dbVer = 6;
this.entities = null;
}
@ -144,13 +144,11 @@ class Dictionary {
return Promise.reject('database not initialized');
}
const tasks = [
this.db.terms.where('dictionary').equals(title).delete(),
this.db.kanji.where('dictionary').equals(title).delete(),
this.db.entities.where('dictionary').equals(title).delete()
];
return Promise.all(tasks).then(() => {
return this.db.terms.where('dictionary').equals(title).delete().then(() => {
return this.db.kanji.where('dictionary').equals(title).delete();
}).then(() => {
return this.db.entities.where('dictionary').equals(title).delete();
}).then(() => {
return this.db.dictionaries.where('title').equals(title).delete();
});
}

View File

@ -181,11 +181,11 @@ function populateDictionaries(opts) {
container.append($(html));
});
const dictDelete = $('.dict-delete');
dictDelete.click(() => {
const dict = dictDelete.closest('.dict');
$('.dict-delete').click(e => {
const dict = $(e.target).closest('.dict');
const title = dict.data('title');
yomichan().translator.dictionary.deleteDictionary(title).then(() => dict.slideUp());
yomichan().translator.dictionary.deleteDictionary(title);
dict.slideUp();
});
container.find('.dict input').change(onOptionsChanged);

File diff suppressed because one or more lines are too long