summaryrefslogtreecommitdiff
path: root/ext/bg/js/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/util.js')
-rw-r--r--ext/bg/js/util.js40
1 files changed, 0 insertions, 40 deletions
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js
index 6e86c2a6..c7ebbb0e 100644
--- a/ext/bg/js/util.js
+++ b/ext/bg/js/util.js
@@ -18,19 +18,6 @@
/*
- * Promise
- */
-
-function promiseCallback(promise, callback) {
- return promise.then(result => {
- callback({result});
- }).catch(error => {
- callback({error});
- });
-}
-
-
-/*
* Commands
*/
@@ -71,30 +58,3 @@ function fgBroadcast(action, params) {
function fgOptionsSet(options) {
fgBroadcast('optionsSet', options);
}
-
-
-/*
- * JSON
- */
-
-function jsonRequest(url, action, params) {
- return new Promise((resolve, reject) => {
- const xhr = new XMLHttpRequest();
- xhr.overrideMimeType('application/json');
- xhr.addEventListener('load', () => resolve(xhr.responseText));
- xhr.addEventListener('error', () => reject('failed to execute network request'));
- xhr.open(action, url);
- if (params) {
- xhr.send(JSON.stringify(params));
- } else {
- xhr.send();
- }
- }).then(responseText => {
- try {
- return JSON.parse(responseText);
- }
- catch (e) {
- return Promise.reject('invalid JSON response');
- }
- });
-}