diff options
Diffstat (limited to 'lib/browser_fix/xhr.js')
-rw-r--r-- | lib/browser_fix/xhr.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/browser_fix/xhr.js b/lib/browser_fix/xhr.js new file mode 100644 index 000000000..aeb9bfaf7 --- /dev/null +++ b/lib/browser_fix/xhr.js @@ -0,0 +1,35 @@ + +/** + * 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; |