xhr.js 553 Bytes
Newer Older
Marian Oancea's avatar
Marian Oancea committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 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;