summaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/main.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-30 09:50:33 -0400
committerGitHub <noreply@github.com>2020-05-30 09:50:33 -0400
commit789da0206b0a452605b49e9f72c4b294088b8046 (patch)
treebd1e0813fb933d93be6a2de5d8b10d1b93662eeb /ext/bg/js/settings/main.js
parent63a3e56367b95f7ea64a5701d17179de60ed8718 (diff)
Organize settings/main.js (#577)
Diffstat (limited to 'ext/bg/js/settings/main.js')
-rw-r--r--ext/bg/js/settings/main.js31
1 files 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();
+})();