summaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/dictionary-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-08-14 12:41:58 -0400
committerGitHub <noreply@github.com>2021-08-14 12:41:58 -0400
commit4839503d540adf7b48d0b1d337bef7b7c9b890ad (patch)
treec33783a36fbc48b55b5b419ab9824e66efcfa8d7 /ext/js/pages/settings/dictionary-controller.js
parent3e350bd563886e49fed309731d99f37e6f3ab320 (diff)
Threaded dictionary delete (#1895)
* Generalize dictionary worker * Add deleteDictionary functionality * Update DictionaryController to use DictionaryDatabaseModifier * Fix incorrect result handling
Diffstat (limited to 'ext/js/pages/settings/dictionary-controller.js')
-rw-r--r--ext/js/pages/settings/dictionary-controller.js18
1 files changed, 4 insertions, 14 deletions
diff --git a/ext/js/pages/settings/dictionary-controller.js b/ext/js/pages/settings/dictionary-controller.js
index 47b256d8..8df4b6bd 100644
--- a/ext/js/pages/settings/dictionary-controller.js
+++ b/ext/js/pages/settings/dictionary-controller.js
@@ -16,7 +16,7 @@
*/
/* global
- * DictionaryDatabase
+ * DictionaryDatabaseModifier
*/
class DictionaryEntry {
@@ -679,19 +679,9 @@ class DictionaryController {
}
async _deleteDictionaryInternal(dictionaryTitle, onProgress) {
- const dictionaryDatabase = await this._getPreparedDictionaryDatabase();
- try {
- await dictionaryDatabase.deleteDictionary(dictionaryTitle, {rate: 1000}, onProgress);
- yomichan.api.triggerDatabaseUpdated('dictionary', 'delete');
- } finally {
- dictionaryDatabase.close();
- }
- }
-
- async _getPreparedDictionaryDatabase() {
- const dictionaryDatabase = new DictionaryDatabase();
- await dictionaryDatabase.prepare();
- return dictionaryDatabase;
+ const dictionaryDatabaseModifier = new DictionaryDatabaseModifier();
+ await dictionaryDatabaseModifier.deleteDictionary(dictionaryTitle, onProgress);
+ yomichan.api.triggerDatabaseUpdated('dictionary', 'delete');
}
async _deleteDictionarySettings(dictionaryTitle) {