From 3270b432bcb007944e3b6e17329b062cb6b7da78 Mon Sep 17 00:00:00 2001 From: Marian Oancea Date: Thu, 6 Nov 2014 22:51:37 +0200 Subject: Refactoring Removed browser fixes Updated gulp to bypass native browser objects Added source map for dist --- lib/browser_fix/xhr.js | 35 ----------------------------------- lib/httprpc.js | 5 +++-- lib/index.js | 6 ------ lib/websocket.js | 5 +++-- 4 files changed, 6 insertions(+), 45 deletions(-) delete mode 100644 lib/browser_fix/xhr.js delete mode 100644 lib/index.js (limited to 'lib') diff --git a/lib/browser_fix/xhr.js b/lib/browser_fix/xhr.js deleted file mode 100644 index aeb9bfaf7..000000000 --- a/lib/browser_fix/xhr.js +++ /dev/null @@ -1,35 +0,0 @@ - -/** - * Module dependencies. - */ - -var global = (function() { return this; })(); // jshint ignore:line - -/** - * XMLHttpRequest constructor. - */ - -var XMLHttpRequest = window.XMLHttpRequest; // jshint ignore:line - -/** - * Module exports. - */ - -module.exports.XMLHttpRequest = XMLHttpRequest ? xhr : null; - -/** - * XMLHttpRequest constructor. - * - * @param {Object) opts (optional) - * @api public - */ - -function xhr(obj) { - var instance; - - instance = new XMLHttpRequest(obj); - - return instance; -} - -if (XMLHttpRequest) xhr.prototype = XMLHttpRequest.prototype; diff --git a/lib/httprpc.js b/lib/httprpc.js index 1968caa98..c1ee0f02a 100644 --- a/lib/httprpc.js +++ b/lib/httprpc.js @@ -21,8 +21,9 @@ * @date 2014 */ - -var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line +if(process.env.NODE_ENV !== "build") { + var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line +} var HttpRpcProvider = function (host) { diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 94a5a45e8..000000000 --- a/lib/index.js +++ /dev/null @@ -1,6 +0,0 @@ -var web3 = require('./main'); -web3.providers.WebSocketProvider = require('./websocket'); -web3.providers.HttpRpcProvider = require('./httprpc'); -web3.providers.QtProvider = require('./qt'); - -module.exports = web3; \ No newline at end of file diff --git a/lib/websocket.js b/lib/websocket.js index 8ccb3d40b..93d58aeba 100644 --- a/lib/websocket.js +++ b/lib/websocket.js @@ -21,8 +21,9 @@ * @date 2014 */ -var WebSocket = require('ws'); // jshint ignore:line - +if(process.env.NODE_ENV !== "build") { + var WebSocket = require('ws'); // jshint ignore:line +} var WebSocketProvider = function(host) { // onmessage handlers -- cgit v1.2.3