aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-14 19:14:29 -0500
committerGitHub <noreply@github.com>2021-01-14 19:14:29 -0500
commit39741bf1d2336091a4d3592ea9ad037ef1f47f79 (patch)
treeef1c4462c3859e0d073644b7debe4f1db0f6f887
parentc1e4741f22a017501f921ecc111b68fae35d0209 (diff)
Convert getDefaultOptions to a utility function (#1235)
-rw-r--r--ext/bg/js/settings/settings-controller.js8
-rw-r--r--ext/bg/js/settings2/sentence-termination-characters-controller.js13
2 files changed, 9 insertions, 12 deletions
diff --git a/ext/bg/js/settings/settings-controller.js b/ext/bg/js/settings/settings-controller.js
index c8b21e21..107e8004 100644
--- a/ext/bg/js/settings/settings-controller.js
+++ b/ext/bg/js/settings/settings-controller.js
@@ -17,6 +17,7 @@
/* global
* HtmlTemplateCollection
+ * OptionsUtil
* api
*/
@@ -124,6 +125,13 @@ class SettingsController extends EventDispatcher {
return this._templates.instantiateFragment(name);
}
+ async getDefaultOptions() {
+ const optionsUtil = new OptionsUtil();
+ await optionsUtil.prepare();
+ const optionsFull = optionsUtil.getDefault();
+ return optionsFull;
+ }
+
// Private
_setProfileIndex(value) {
diff --git a/ext/bg/js/settings2/sentence-termination-characters-controller.js b/ext/bg/js/settings2/sentence-termination-characters-controller.js
index 173c609b..1e055f40 100644
--- a/ext/bg/js/settings2/sentence-termination-characters-controller.js
+++ b/ext/bg/js/settings2/sentence-termination-characters-controller.js
@@ -15,10 +15,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* global
- * OptionsUtil
- */
-
class SentenceTerminationCharactersController {
constructor(settingsController) {
this._settingsController = settingsController;
@@ -135,18 +131,11 @@ class SentenceTerminationCharactersController {
}
async _reset() {
- const defaultOptions = await this._getDefaultOptions();
+ const defaultOptions = await this._settingsController.getDefaultOptions();
const value = defaultOptions.profiles[0].options.sentenceParsing.terminationCharacters;
await this._settingsController.setProfileSetting('sentenceParsing.terminationCharacters', value);
await this._updateOptions();
}
-
- async _getDefaultOptions() {
- const optionsUtil = new OptionsUtil();
- await optionsUtil.prepare();
- const optionsFull = optionsUtil.getDefault();
- return optionsFull;
- }
}
class SentenceTerminationCharacterEntry {