diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-11 21:11:07 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-13 23:11:56 -0500 |
commit | b1f72905cf70a9ddb94f033cae0cb7cc03468e21 (patch) | |
tree | 6d425cd504eef79dc3b53cb35e79b5ac48f733fd /ext/bg/js/settings/dictionaries.js | |
parent | 17277a645020bf13bef9aaf1c1292f2b1a7cea02 (diff) |
Add functions for modifying mutable options
Diffstat (limited to 'ext/bg/js/settings/dictionaries.js')
-rw-r--r-- | ext/bg/js/settings/dictionaries.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/bg/js/settings/dictionaries.js b/ext/bg/js/settings/dictionaries.js index 381d1ae2..69f6d544 100644 --- a/ext/bg/js/settings/dictionaries.js +++ b/ext/bg/js/settings/dictionaries.js @@ -273,7 +273,7 @@ class SettingsDictionaryEntryUI { progress.hidden = true; const optionsContext = getOptionsContext(); - const options = await apiOptionsGet(optionsContext); + const options = await getOptionsMutable(optionsContext); onDatabaseUpdated(options); } } @@ -360,7 +360,7 @@ async function dictSettingsInitialize() { document.querySelector('#database-enable-prefix-wildcard-searches').addEventListener('change', (e) => onDatabaseEnablePrefixWildcardSearchesChanged(e), false); const optionsContext = getOptionsContext(); - const options = await apiOptionsGet(optionsContext); + const options = await getOptionsMutable(optionsContext); onDictionaryOptionsChanged(options); onDatabaseUpdated(options); } @@ -425,7 +425,7 @@ async function updateMainDictionarySelect(options, dictionaries) { async function onDictionaryMainChanged(e) { const value = e.target.value; const optionsContext = getOptionsContext(); - const options = await apiOptionsGet(optionsContext); + const options = await getOptionsMutable(optionsContext); options.general.mainDictionary = value; settingsSaveOptions(); } @@ -531,14 +531,14 @@ async function onDictionaryPurge(e) { dictionarySpinnerShow(true); await utilDatabasePurge(); - for (const {options} of toIterable((await apiOptionsGetFull()).profiles)) { + for (const {options} of toIterable((await getOptionsFullMutable()).profiles)) { options.dictionaries = utilBackgroundIsolate({}); options.general.mainDictionary = ''; } await settingsSaveOptions(); const optionsContext = getOptionsContext(); - const options = await apiOptionsGet(optionsContext); + const options = await getOptionsMutable(optionsContext); onDatabaseUpdated(options); } catch (err) { dictionaryErrorsShow([err]); @@ -593,7 +593,7 @@ async function onDictionaryImport(e) { } const {result, errors} = await utilDatabaseImport(files[i], updateProgress, importDetails); - for (const {options} of toIterable((await apiOptionsGetFull()).profiles)) { + for (const {options} of toIterable((await getOptionsFullMutable()).profiles)) { const dictionaryOptions = SettingsDictionaryListUI.createDictionaryOptions(); dictionaryOptions.enabled = true; options.dictionaries[result.title] = dictionaryOptions; @@ -611,7 +611,7 @@ async function onDictionaryImport(e) { } const optionsContext = getOptionsContext(); - const options = await apiOptionsGet(optionsContext); + const options = await getOptionsMutable(optionsContext); onDatabaseUpdated(options); } } catch (err) { @@ -630,7 +630,7 @@ async function onDictionaryImport(e) { async function onDatabaseEnablePrefixWildcardSearchesChanged(e) { - const optionsFull = await apiOptionsGetFull(); + const optionsFull = await getOptionsFullMutable(); const v = !!e.target.checked; if (optionsFull.global.database.prefixWildcardsSupported === v) { return; } optionsFull.global.database.prefixWildcardsSupported = !!e.target.checked; |