aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/dictionary-import-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-03-02 20:27:51 -0500
committerGitHub <noreply@github.com>2021-03-02 20:27:51 -0500
commit4208595293a18c2cd95064caf77db786c2902ac8 (patch)
treebff87aa2eb501ad5cd11bdf70b2048edb662ffa2 /ext/js/pages/settings/dictionary-import-controller.js
parent571b865ae5207acb8e58a5ee38e4ed900194f7fb (diff)
Persistent storage controller (#1478)
* Add PersistentStorageController * Update DictionaryController * Update DictionaryImportController * Update when storage stats are updated
Diffstat (limited to 'ext/js/pages/settings/dictionary-import-controller.js')
-rw-r--r--ext/js/pages/settings/dictionary-import-controller.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/ext/js/pages/settings/dictionary-import-controller.js b/ext/js/pages/settings/dictionary-import-controller.js
index 1389b7f0..ce724263 100644
--- a/ext/js/pages/settings/dictionary-import-controller.js
+++ b/ext/js/pages/settings/dictionary-import-controller.js
@@ -22,10 +22,9 @@
*/
class DictionaryImportController {
- constructor(settingsController, modalController, storageController, statusFooter) {
+ constructor(settingsController, modalController, statusFooter) {
this._settingsController = settingsController;
this._modalController = modalController;
- this._storageController = storageController;
this._statusFooter = statusFooter;
this._modifying = false;
this._purgeButton = null;
@@ -92,7 +91,6 @@ class DictionaryImportController {
if (this._modifying) { return; }
const purgeNotification = this._purgeNotification;
- const storageController = this._storageController;
const prevention = this._preventPageExit();
try {
@@ -114,7 +112,7 @@ class DictionaryImportController {
if (purgeNotification !== null) { purgeNotification.hidden = true; }
this._setSpinnerVisible(false);
this._setModifying(false);
- if (storageController !== null) { storageController.updateStats(); }
+ this._triggerStorageChanged();
}
}
@@ -122,7 +120,6 @@ class DictionaryImportController {
if (this._modifying) { return; }
const statusFooter = this._statusFooter;
- const storageController = this._storageController;
const importInfo = document.querySelector('#dictionary-import-info');
const progressSelector = '.dictionary-import-progress';
const progressContainers = [
@@ -156,7 +153,7 @@ class DictionaryImportController {
const statusString = `${percent.toFixed(0)}%`;
for (const progressBar of progressBars) { progressBar.style.width = cssString; }
for (const label of statusLabels) { label.textContent = statusString; }
- if (storageController !== null) { storageController.updateStats(); }
+ this._triggerStorageChanged();
};
const fileCount = files.length;
@@ -186,7 +183,7 @@ class DictionaryImportController {
}
this._setSpinnerVisible(false);
this._setModifying(false);
- if (storageController !== null) { storageController.updateStats(); }
+ this._triggerStorageChanged();
}
}
@@ -342,4 +339,8 @@ class DictionaryImportController {
}
return errors;
}
+
+ _triggerStorageChanged() {
+ yomichan.trigger('storageChanged');
+ }
}