cleanup console.logs

v1.18.x
barisusakli 9 years ago
parent 224c311b5e
commit 52a0430603

@ -1,25 +1,32 @@
// see https://gist.github.com/jfromaniello/4087861#gistcomment-1447029 // see https://gist.github.com/jfromaniello/4087861#gistcomment-1447029
// XMLHttpRequest to override. // XMLHttpRequest to override.
//var xhrPath = '../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/xmlhttprequest'; /* globals console, require, module */
var xhrPath = '../../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/xmlhttprequest-ssl'; var npm2Path = '../../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/xmlhttprequest-ssl';
var name; var npm3Path = '../../node_modules/xmlhttprequest-ssl';
var filePath;
var winston = require('winston');
// Make initial call to require so module is cached. // Make initial call to require so module is cached.
try { try {
require(xhrPath); require(npm2Path);
name = require.resolve(xhrPath); filePath = require.resolve(npm2Path);
} catch (err) { } catch (err) {
console.log('err1', err); if (err) {
winston.info('Couldn\'t find ' + npm2Path);
}
try { try {
require('../../node_modules/xmlhttprequest-ssl'); require(npm3Path);
name = require.resolve('xmlhttprequest-ssl'); filePath = require.resolve(npm3Path);
} catch (err) { } catch (err) {
console.log('err2', err); if (err) {
winston.info('Couldn\'t find ' + npm3Path);
}
} }
} }
console.log(name); winston.info('xmlhttprequest-ssl path: ' + filePath);
// Get cached version. // Get cached version.
var cachedXhr = require.cache[name]; var cachedXhr = require.cache[filePath];
var stdXhr = cachedXhr.exports; var stdXhr = cachedXhr.exports;
// Callbacks exposes an object that callback functions can be added to. // Callbacks exposes an object that callback functions can be added to.
@ -32,7 +39,7 @@ var newXhr = function () {
callbacks[method].apply(this, arguments); callbacks[method].apply(this, arguments);
} }
} }
} };
newXhr.XMLHttpRequest = newXhr; newXhr.XMLHttpRequest = newXhr;

Loading…
Cancel
Save