diff options
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); - }); + } } } |