summaryrefslogtreecommitdiff
path: root/ext/js/pages/welcome-main.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-02-01 10:00:59 -0500
committerGitHub <noreply@github.com>2024-02-01 15:00:59 +0000
commitdfd42bad0b46845ad88d1fdc5fa82b4f03bab0f3 (patch)
tree04686b943b84b33b8927238be17e4bc0dda7eb62 /ext/js/pages/welcome-main.js
parent2356223942a21d1683ac38eed8e7b9485f453d87 (diff)
Application refactor (#591)
* Rename Yomitan class to Application, change initialization style * Rename file * Update init * Update config * Remove dead code
Diffstat (limited to 'ext/js/pages/welcome-main.js')
-rw-r--r--ext/js/pages/welcome-main.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/ext/js/pages/welcome-main.js b/ext/js/pages/welcome-main.js
index 35472ec2..030d2826 100644
--- a/ext/js/pages/welcome-main.js
+++ b/ext/js/pages/welcome-main.js
@@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import {Application} from '../application.js';
import {log} from '../core/logger.js';
import {DocumentFocusController} from '../dom/document-focus-controller.js';
import {querySelectorNotNull} from '../dom/query-selector.js';
-import {yomitan} from '../yomitan.js';
import {ExtensionContentController} from './common/extension-content-controller.js';
import {DictionaryController} from './settings/dictionary-controller.js';
import {DictionaryImportController} from './settings/dictionary-import-controller.js';
@@ -31,10 +31,12 @@ import {SettingsController} from './settings/settings-controller.js';
import {SettingsDisplayController} from './settings/settings-display-controller.js';
import {StatusFooter} from './settings/status-footer.js';
-/** */
-async function setupEnvironmentInfo() {
+/**
+ * @param {import('../comm/api.js').API} api
+ */
+async function setupEnvironmentInfo(api) {
const {manifest_version: manifestVersion} = chrome.runtime.getManifest();
- const {browser, platform} = await yomitan.api.getEnvironmentInfo();
+ const {browser, platform} = await api.getEnvironmentInfo();
document.documentElement.dataset.browser = browser;
document.documentElement.dataset.os = platform.os;
document.documentElement.dataset.manifestVersion = `${manifestVersion}`;
@@ -62,9 +64,10 @@ async function main() {
const statusFooter = new StatusFooter(statusFooterElement);
statusFooter.prepare();
- await yomitan.prepare();
+ const application = new Application();
+ await application.prepare();
- setupEnvironmentInfo();
+ setupEnvironmentInfo(application.api);
chrome.storage.session.get({'needsCustomTemplatesWarning': false}).then((result) => {
if (result.needsCustomTemplatesWarning) {
@@ -78,7 +81,7 @@ async function main() {
const modalController = new ModalController();
modalController.prepare();
- const settingsController = new SettingsController();
+ const settingsController = new SettingsController(application);
await settingsController.prepare();
const dictionaryController = new DictionaryController(settingsController, modalController, statusFooter);