From 789da0206b0a452605b49e9f72c4b294088b8046 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 30 May 2020 09:50:33 -0400 Subject: Organize settings/main.js (#577) --- ext/bg/js/settings/main.js | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index cf74c0fc..e22c5e53 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -62,7 +62,7 @@ async function setupEnvironmentInfo() { } -async function onReady() { +(async () => { api.forwardLogsToBackend(); await yomichan.prepare(); @@ -71,6 +71,7 @@ async function onReady() { settingsPopulateModifierKeys(); const optionsFull = await api.optionsGetFull(); + const settingsController = new SettingsController(optionsFull.profileCurrent); settingsController.prepare(); @@ -79,16 +80,28 @@ async function onReady() { const genericSettingController = new GenericSettingController(settingsController); genericSettingController.prepare(); - new ClipboardPopupsController(settingsController).prepare(); - new PopupPreviewController(settingsController).prepare(); - new AudioController(settingsController).prepare(); - new ProfileController(settingsController).prepare(); + + const clipboardPopupsController = new ClipboardPopupsController(settingsController); + clipboardPopupsController.prepare(); + + const popupPreviewController = new PopupPreviewController(settingsController); + popupPreviewController.prepare(); + + const audioController = new AudioController(settingsController); + audioController.prepare(); + + const profileController = new ProfileController(settingsController); + profileController.prepare(); + const dictionaryController = new DictionaryController(settingsController, storageController); dictionaryController.prepare(); + const ankiController = new AnkiController(settingsController); ankiController.prepare(); - new AnkiTemplatesController(settingsController, ankiController).prepare(); - new SettingsBackup(settingsController).prepare(); -} -$(document).ready(() => onReady()); + const ankiTemplatesController = new AnkiTemplatesController(settingsController, ankiController); + ankiTemplatesController.prepare(); + + const settingsBackup = new SettingsBackup(settingsController); + settingsBackup.prepare(); +})(); -- cgit v1.2.3