From 48e4bccf0d24bb6ce53c4ecea567ed7750fe8949 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 17 Jun 2018 20:21:39 +0900 Subject: Use async/await on background --- src/background/index.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/background/index.js') 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(); -- cgit v1.2.3