diff options
author | Alex Yatskov <FooSoft@users.noreply.github.com> | 2019-05-05 18:26:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-05 18:26:02 -0700 |
commit | 61d1168d94a7467be6e98afc375d7583c0f23cb5 (patch) | |
tree | 383b42f3b616c033d24f62b8d883121f6687558f /ext/fg/js | |
parent | 43c5ef87c03307e8281366725f1196307effa9c7 (diff) | |
parent | f2a5d5095931a78dc388d4cba66953560a336e7f (diff) |
Merge pull request #160 from toasted-nutbread/mobile
Add support for mobile Firefox
Diffstat (limited to 'ext/fg/js')
-rw-r--r-- | ext/fg/js/frontend.js | 2 | ||||
-rw-r--r-- | ext/fg/js/util.js | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index a81cbef8..bd652f3b 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -256,7 +256,7 @@ class Frontend { } onError(error) { - window.alert(`Error: ${error.toString ? error.toString() : error}`); + console.log(error); } popupTimerSet(callback) { diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js index 5eff4018..954b3988 100644 --- a/ext/fg/js/util.js +++ b/ext/fg/js/util.js @@ -26,11 +26,15 @@ function utilAsync(func) { function utilInvoke(action, params={}) { return new Promise((resolve, reject) => { try { - chrome.runtime.sendMessage({action, params}, ({result, error}) => { - if (error) { - reject(error); + chrome.runtime.sendMessage({action, params}, (response) => { + if (response !== null && typeof response === 'object') { + if (response.error) { + reject(response.error); + } else { + resolve(response.result); + } } else { - resolve(result); + reject(`Unexpected response of type ${typeof response}`); } }); } catch (e) { |