aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/dictionary-import-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-13 18:43:44 -0400
committerGitHub <noreply@github.com>2020-09-13 18:43:44 -0400
commit5ec5d0c91c0726ed74b0cb8772d992ae478625b8 (patch)
tree65c5c17c0b8c8cea2def98a79801568ea55fd12d /ext/bg/js/settings/dictionary-import-controller.js
parent8b033a1650ff9425963c164aba1a744aada93f20 (diff)
Database change event (#826)
* Add api.triggerDatabaseUpdated and yomichan.on('databaseUpdated') * Update databaseUpdated event usage
Diffstat (limited to 'ext/bg/js/settings/dictionary-import-controller.js')
-rw-r--r--ext/bg/js/settings/dictionary-import-controller.js9
1 files changed, 1 insertions, 8 deletions
diff --git a/ext/bg/js/settings/dictionary-import-controller.js b/ext/bg/js/settings/dictionary-import-controller.js
index b10c87d0..cce695d0 100644
--- a/ext/bg/js/settings/dictionary-import-controller.js
+++ b/ext/bg/js/settings/dictionary-import-controller.js
@@ -110,8 +110,6 @@ class DictionaryImportController {
if (errors.length > 0) {
this._showErrors(errors);
}
-
- this._triggerDatabaseUpdated('purge');
} catch (error) {
this._showErrors([error]);
} finally {
@@ -178,6 +176,7 @@ class DictionaryImportController {
const dictionaryImporter = new DictionaryImporter();
const archiveContent = await this._readFile(file);
const {result, errors} = await dictionaryImporter.importDictionary(dictionaryDatabase, archiveContent, importDetails, onProgress);
+ api.triggerDatabaseUpdated('dictionary', 'import');
const errors2 = await this._addDictionarySettings(result.sequenced, result.title);
if (errors.length > 0) {
@@ -185,8 +184,6 @@ class DictionaryImportController {
allErrors.push(new Error(`Dictionary may not have been imported properly: ${allErrors.length} error${allErrors.length === 1 ? '' : 's'} reported.`));
this._showErrors(allErrors);
}
-
- this._triggerDatabaseUpdated('import');
} finally {
dictionaryDatabase.close();
}
@@ -271,10 +268,6 @@ class DictionaryImportController {
this._errorContainer.hidden = true;
}
- _triggerDatabaseUpdated(cause) {
- this._settingsController.triggerDatabaseUpdated(cause);
- }
-
_readFile(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();