aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/backend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-08-01 11:46:35 -0400
committerGitHub <noreply@github.com>2020-08-01 11:46:35 -0400
commitb52074b3f0df09b9e37a210789507aa553a2dc9d (patch)
treec877b6f3c757468e34e1ac71f9626eb54bd1c0a5 /ext/bg/js/backend.js
parentf1e7288c11db2ef615696f90d12f2e028a215998 (diff)
Options util (#700)
* Move options functions into a class * Rename and privatize * Organize by public/private * Refactor to use async function * Simplify update function signature * Add comment for update * Rename * Copy _applyUpdates into _legacyProfileUpdateUpdateVersion * Organize * Move profile options updates * Refactor update details * Add async support * Formatting
Diffstat (limited to 'ext/bg/js/backend.js')
-rw-r--r--ext/bg/js/backend.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index ded343c7..2e772aa1 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -27,13 +27,12 @@
* JsonSchema
* Mecab
* ObjectPropertyAccessor
+ * OptionsUtil
* TemplateRenderer
* Translator
* conditionsTestValue
* dictTermsSort
* jp
- * optionsLoad
- * optionsSave
* profileConditionsDescriptor
* profileConditionsDescriptorPromise
* requestJson
@@ -202,7 +201,7 @@ class Backend {
this._optionsSchema = await requestJson(chrome.runtime.getURL('/bg/data/options-schema.json'), 'GET');
this._defaultAnkiFieldTemplates = (await requestText(chrome.runtime.getURL('/bg/data/default-anki-field-templates.handlebars'), 'GET')).trim();
- this._options = await optionsLoad();
+ this._options = await OptionsUtil.load();
this._options = JsonSchema.getValidValueOrDefault(this._optionsSchema, this._options);
this._applyOptions('background');
@@ -396,7 +395,7 @@ class Backend {
async _onApiOptionsSave({source}) {
const options = this.getFullOptions();
- await optionsSave(options);
+ await OptionsUtil.save(options);
this._applyOptions(source);
}