From bdaa77ff0d7c23f1594575ac22fb9693f1802b24 Mon Sep 17 00:00:00 2001 From: Cashew <52880648+Scrub1492@users.noreply.github.com> Date: Mon, 25 Dec 2023 17:13:34 +0900 Subject: Narrow down enum types (#431) * narrow down enum types * add enum types * change from default to case * add enum types * remove comments * remove comments * fix * Move getErrorLevelValue to Logger * Add enum type for LogErrorLevelValue * add eslint switch-exhaustiveness-check rule * Revert "add eslint switch-exhaustiveness-check" This reverts commit 49f9caabf0af900bc5ba2b80f5baff72c27e02cd. * move from labelled loop to helper functions * move helper functions downward --- ext/js/pages/settings/dictionary-import-controller.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ext/js/pages/settings') diff --git a/ext/js/pages/settings/dictionary-import-controller.js b/ext/js/pages/settings/dictionary-import-controller.js index c478b265..79a62d32 100644 --- a/ext/js/pages/settings/dictionary-import-controller.js +++ b/ext/js/pages/settings/dictionary-import-controller.js @@ -161,6 +161,7 @@ export class DictionaryImportController { }; let statusPrefix = ''; + /** @type {import('dictionary-importer.js').ImportStep} */ let stepIndex = -2; /** @type {import('dictionary-worker').ImportProgressCallback} */ const onProgress = (data) => { @@ -178,8 +179,8 @@ export class DictionaryImportController { for (const label of statusLabels) { label.textContent = statusString; } switch (stepIndex2) { - case -2: // Initialize - case 5: // Data import + case -2: + case 5: this._triggerStorageChanged(); break; } @@ -210,11 +211,12 @@ export class DictionaryImportController { } /** - * @param {number} stepIndex + * @param {import('dictionary-importer').ImportStep} stepIndex * @returns {string} */ _getImportLabel(stepIndex) { switch (stepIndex) { + case -2: return ''; case -1: case 0: return 'Loading dictionary'; case 1: return 'Loading schemas'; @@ -222,7 +224,6 @@ export class DictionaryImportController { case 3: return 'Formatting data'; case 4: return 'Importing media'; case 5: return 'Importing data'; - default: return ''; } } -- cgit v1.2.3