diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-06-18 20:52:54 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-18 20:52:54 +0900 |
commit | 897e010f42cbc9968cf1058116b0f8bbe9e9a4fd (patch) | |
tree | 3cba586e52ef703d1b49a85ad15d91aca4cbc65f /src/content/components/common/index.js | |
parent | 7cae7302bd39a7963b765cd3defd05a093c104a6 (diff) | |
parent | b74acf6f6aef4e4241ba62c72ed8ddb21adc751d (diff) |
Merge pull request #417 from ueokande/async-function
Use await/async on e2e test
Diffstat (limited to 'src/content/components/common/index.js')
-rw-r--r-- | src/content/components/common/index.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/content/components/common/index.js b/src/content/components/common/index.js index 9b7b083..6437011 100644 --- a/src/content/components/common/index.js +++ b/src/content/components/common/index.js @@ -44,15 +44,16 @@ export default class Common { } } - reloadSettings() { - browser.runtime.sendMessage({ - type: messages.SETTINGS_QUERY, - }).then((settings) => { + async reloadSettings() { + try { + let settings = await browser.runtime.sendMessage({ + type: messages.SETTINGS_QUERY, + }); this.store.dispatch(settingActions.set(settings)); - }).catch((e) => { + } catch (e) { // Sometime sendMessage fails when background script is not ready. console.warn(e); setTimeout(() => this.reloadSettings(), 500); - }); + } } } |