Use await/async on settings

jh-changes
Shin'ya Ueoka 7 years ago
parent 7f56a08f3b
commit 94d411234a
  1. 13
      src/settings/actions/setting.js

@ -4,20 +4,17 @@ import DefaultSettings from 'shared/settings/default';
import * as settingsStorage from 'shared/settings/storage';
import * as settingsValues from 'shared/settings/values';
const load = () => {
return settingsStorage.loadRaw().then((settings) => {
const load = async() => {
let settings = await settingsStorage.loadRaw();
return set(settings);
});
};
const save = (settings) => {
return settingsStorage.save(settings).then(() => {
return browser.runtime.sendMessage({
const save = async(settings) => {
await settingsStorage.save(settings);
await browser.runtime.sendMessage({
type: messages.SETTINGS_RELOAD
});
}).then(() => {
return set(settings);
});
};
const set = (settings) => {