diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-06-17 21:56:54 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-06-17 22:04:20 +0900 |
commit | 94d411234ada47bef2c8f4a3b0fc77904f0900a6 (patch) | |
tree | 5a4b94e8efc5c91c146ccbe6301bab8d863787f7 | |
parent | 7f56a08f3ba5407e6c8cdec12dc59aa71aa06d03 (diff) |
Use await/async on settings
-rw-r--r-- | src/settings/actions/setting.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/settings/actions/setting.js b/src/settings/actions/setting.js index 92c9f8a..1219ba5 100644 --- a/src/settings/actions/setting.js +++ b/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) => { - return set(settings); - }); +const load = async() => { + let settings = await settingsStorage.loadRaw(); + return set(settings); }; -const save = (settings) => { - return settingsStorage.save(settings).then(() => { - return browser.runtime.sendMessage({ - type: messages.SETTINGS_RELOAD - }); - }).then(() => { - return set(settings); +const save = async(settings) => { + await settingsStorage.save(settings); + await browser.runtime.sendMessage({ + type: messages.SETTINGS_RELOAD }); + return set(settings); }; const set = (settings) => { |