aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/main.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-29 19:47:18 -0400
committerGitHub <noreply@github.com>2020-05-29 19:47:18 -0400
commitfde0072118128ea698e15472c9b61b17b4827c8a (patch)
treefcce97c5e96d2e814597917a40e18d82c8db9ad5 /ext/bg/js/settings/main.js
parent8537c8f386b7c04f21e62a6b82b179ec9a123ce1 (diff)
Change profile.js into a class (#566)
* Update how settings profile is stored and accessed * Convert profiles.js into a class * Rename members of ProfileController
Diffstat (limited to 'ext/bg/js/settings/main.js')
-rw-r--r--ext/bg/js/settings/main.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js
index 0cb1734e..64611ad5 100644
--- a/ext/bg/js/settings/main.js
+++ b/ext/bg/js/settings/main.js
@@ -16,6 +16,7 @@
*/
/* global
+ * ProfileController
* SettingsBackup
* SettingsController
* ankiInitialize
@@ -25,15 +26,28 @@
* appearanceInitialize
* audioSettingsInitialize
* dictSettingsInitialize
- * getOptionsContext
* onAnkiOptionsChanged
* onDictionaryOptionsChanged
- * profileOptionsSetup
* storageInfoInitialize
* utilBackend
* utilBackgroundIsolate
*/
+let profileIndex = 0;
+
+function getOptionsContext() {
+ return {index: getProfileIndex()};
+}
+
+function getProfileIndex() {
+ return profileIndex;
+}
+
+function setProfileIndex(value) {
+ profileIndex = value;
+}
+
+
function getOptionsMutable(optionsContext) {
return utilBackend().getOptions(
utilBackgroundIsolate(optionsContext)
@@ -302,7 +316,7 @@ async function onReady() {
formSetupEventListeners();
appearanceInitialize();
await audioSettingsInitialize();
- await profileOptionsSetup();
+ await (new ProfileController()).prepare();
await dictSettingsInitialize();
ankiInitialize();
ankiTemplatesInitialize();