summaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/settings-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-30 16:23:56 -0400
committerGitHub <noreply@github.com>2020-05-30 16:23:56 -0400
commit976a200ffc65e94f0246392f6b29505f1eb4f16c (patch)
treebc33257947294a1ffbccfb036203c0a2f842670d /ext/bg/js/settings/settings-controller.js
parentc8810bc92972d14858cdad637eb0a078cae46349 (diff)
Backup update (#582)
* Add function to assign all settings * Update how settings backups are restored * Remove page reload * Update profile index after importing
Diffstat (limited to 'ext/bg/js/settings/settings-controller.js')
-rw-r--r--ext/bg/js/settings/settings-controller.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/ext/bg/js/settings/settings-controller.js b/ext/bg/js/settings/settings-controller.js
index 9224aedf..4c902dff 100644
--- a/ext/bg/js/settings/settings-controller.js
+++ b/ext/bg/js/settings/settings-controller.js
@@ -38,9 +38,7 @@ class SettingsController extends EventDispatcher {
set profileIndex(value) {
if (this._profileIndex === value) { return; }
- this._profileIndex = value;
- this.trigger('optionsContextChanged');
- this._onOptionsUpdatedInternal();
+ this._setProfileIndex(value);
}
prepare() {
@@ -69,9 +67,10 @@ class SettingsController extends EventDispatcher {
return utilBackend().getFullOptions();
}
- async setOptionsFull(optionsFull) {
- utilBackend().setFullOptions(utilBackgroundIsolate(optionsFull));
- await this.save();
+ async setAllSettings(value) {
+ const profileIndex = value.profileCurrent;
+ await api.setAllSettings(value, this._source);
+ this._setProfileIndex(profileIndex);
}
async getGlobalSettings(targets) {
@@ -104,6 +103,12 @@ class SettingsController extends EventDispatcher {
// Private
+ _setProfileIndex(value) {
+ this._profileIndex = value;
+ this.trigger('optionsContextChanged');
+ this._onOptionsUpdatedInternal();
+ }
+
_onOptionsUpdated({source}) {
if (source === this._source) { return; }
this._onOptionsUpdatedInternal();