From c0fc8d3b7a0dc581282daaf17aeb38197c36d3f2 Mon Sep 17 00:00:00 2001 From: Zach Ferland Date: Wed, 15 Feb 2017 18:18:30 -0500 Subject: [PATCH] add meteor support for xmlhttprequest --- package.json | 4 +--- src/index.js | 4 ++-- src/lib/XMLHttpRequest-browser.js | 3 --- src/lib/XMLHttpRequest.js | 3 --- 4 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 src/lib/XMLHttpRequest-browser.js delete mode 100644 src/lib/XMLHttpRequest.js diff --git a/package.json b/package.json index 07d8a37..5e019dc 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,7 @@ "xmlhttprequest": "^1.8.0" }, "browser": { - "xmlhttprequest": false, - "./src/lib/XMLHttpRequest.js": "./src/lib/XMLHttpRequest-browser.js", - "./lib/lib/XMLHttpRequest.js": "./lib/lib/XMLHttpRequest-browser.js" + "xmlhttprequest": false }, "jest": { "coverageDirectory": "./coverage/", diff --git a/src/index.js b/src/index.js index a82fd09..5f44747 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,7 @@ var BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' var base58 = require('base-x-bytearray')(BASE58) var hex = require('base-x-bytearray')('0123456789abcdef') -const XMLHttpRequest = require('./lib/XMLHttpRequest') +const XMLHttpRequest = window.XMLHttpRequest || require('xmlhttprequest').XMLHttpRequest const getAttributesData = '0x446d5aa4000000000000000000000000' function http (opts, callback) { @@ -84,4 +84,4 @@ function UportLite (opts = {}) { return getAttributes } -module.exports = UportLite \ No newline at end of file +module.exports = UportLite diff --git a/src/lib/XMLHttpRequest-browser.js b/src/lib/XMLHttpRequest-browser.js deleted file mode 100644 index 69453cc..0000000 --- a/src/lib/XMLHttpRequest-browser.js +++ /dev/null @@ -1,3 +0,0 @@ -const XMLHttpRequest = window.XMLHttpRequest; // eslint-disable-line - -module.exports = XMLHttpRequest; diff --git a/src/lib/XMLHttpRequest.js b/src/lib/XMLHttpRequest.js deleted file mode 100644 index ba406dd..0000000 --- a/src/lib/XMLHttpRequest.js +++ /dev/null @@ -1,3 +0,0 @@ -const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; - -module.exports = XMLHttpRequest;