aboutsummaryrefslogtreecommitdiff
path: root/src/settings/actions/setting.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-09 17:03:52 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-10-09 17:03:52 +0900
commit805d1395fc869235f079438b5b4884a521c0230e (patch)
treeaba110eb78b4ce3eb6cefb8100f167e17a23fcc3 /src/settings/actions/setting.js
parent6669f6b6ef2a3268dfeca87dbccc2ac8ef2fa30d (diff)
save settings on the fly
Diffstat (limited to 'src/settings/actions/setting.js')
-rw-r--r--src/settings/actions/setting.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/settings/actions/setting.js b/src/settings/actions/setting.js
index 3525f0a..c1b27c8 100644
--- a/src/settings/actions/setting.js
+++ b/src/settings/actions/setting.js
@@ -3,8 +3,7 @@ import messages from 'shared/messages';
import DefaultSettings from 'shared/default-settings';
const load = () => {
- return browser.storage.local.get('settings').then((value) => {
- let settings = value.settings;
+ return browser.storage.local.get('settings').then(({ settings }) => {
if (settings) {
return set(settings);
}
@@ -18,6 +17,8 @@ const save = (settings) => {
}).then(() => {
return browser.runtime.sendMessage({
type: messages.SETTINGS_RELOAD
+ }).then(() => {
+ return set(settings);
});
});
};
@@ -25,6 +26,7 @@ const save = (settings) => {
const set = (settings) => {
return {
type: actions.SETTING_SET_SETTINGS,
+ source: settings.source,
json: settings.json,
value: JSON.parse(settings.json),
};