diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-06-17 20:21:39 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-06-17 21:55:25 +0900 |
commit | 48e4bccf0d24bb6ce53c4ecea567ed7750fe8949 (patch) | |
tree | 7c16a68489f2894564da18ae059ba492db88907a /src/background/index.js | |
parent | 88238005ab64f957d9def8c18473d8210b280de9 (diff) |
Use async/await on background
Diffstat (limited to 'src/background/index.js')
-rw-r--r-- | src/background/index.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/background/index.js b/src/background/index.js index 3f1013c..02de53f 100644 --- a/src/background/index.js +++ b/src/background/index.js @@ -18,6 +18,15 @@ const store = createStore(reducers, (e, sender) => { } }); +const checkAndNotifyUpdated = async() => { + let updated = await versions.checkUpdated(); + if (!updated) { + return; + } + await versions.notify(); + await versions.commit(); +}; + /* eslint-disable no-unused-vars */ const backgroundComponent = new BackgroundComponent(store); const operationComponent = new OperationComponent(store); @@ -27,11 +36,4 @@ const indicatorComponent = new IndicatorComponent(store); store.dispatch(settingActions.load()); -versions.checkUpdated().then((updated) => { - if (!updated) { - return; - } - return versions.notify(); -}).then(() => { - return versions.commit(); -}); +checkAndNotifyUpdated(); |