diff options
Diffstat (limited to 'ext/bg/js/settings')
-rw-r--r-- | ext/bg/js/settings/dictionary-controller.js | 6 | ||||
-rw-r--r-- | ext/bg/js/settings/dictionary-import-controller.js | 9 | ||||
-rw-r--r-- | ext/bg/js/settings/settings-controller.js | 4 |
3 files changed, 3 insertions, 16 deletions
diff --git a/ext/bg/js/settings/dictionary-controller.js b/ext/bg/js/settings/dictionary-controller.js index 9292d2c4..eccb0e88 100644 --- a/ext/bg/js/settings/dictionary-controller.js +++ b/ext/bg/js/settings/dictionary-controller.js @@ -307,8 +307,6 @@ class SettingsDictionaryEntryUI { prevention.end(); this.isDeleting = false; progress.hidden = true; - - this.parent.trigger('databaseUpdated'); } } @@ -397,13 +395,13 @@ class DictionaryController { ); this._dictionaryUI.save = () => this._settingsController.save(); this._dictionaryUI.preventPageExit = this._preventPageExit.bind(this); - this._dictionaryUI.on('databaseUpdated', this._onDatabaseUpdated.bind(this)); document.querySelector('#dict-main').addEventListener('change', this._onDictionaryMainChanged.bind(this), false); document.querySelector('#database-enable-prefix-wildcard-searches').addEventListener('change', this._onDatabaseEnablePrefixWildcardSearchesChanged.bind(this), false); this._settingsController.on('optionsChanged', this._onOptionsChanged.bind(this)); - this._settingsController.on('databaseUpdated', this._onDatabaseUpdated.bind(this)); + + yomichan.on('databaseUpdated', this._onDatabaseUpdated.bind(this)); await this._onOptionsChanged(); await this._onDatabaseUpdated(); 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(); diff --git a/ext/bg/js/settings/settings-controller.js b/ext/bg/js/settings/settings-controller.js index d2656beb..4e61e05c 100644 --- a/ext/bg/js/settings/settings-controller.js +++ b/ext/bg/js/settings/settings-controller.js @@ -125,10 +125,6 @@ class SettingsController extends EventDispatcher { return obj; } - triggerDatabaseUpdated(cause) { - this.trigger('databaseUpdated', {cause}); - } - // Private _setProfileIndex(value) { |