xmlhttprequest.js 874 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. // browser shim for xmlhttprequest module
  3. var __importDefault = (this && this.__importDefault) || function (mod) {
  4. return (mod && mod.__esModule) ? mod : { "default": mod };
  5. };
  6. Object.defineProperty(exports, "__esModule", { value: true });
  7. const has_cors_1 = __importDefault(require("has-cors"));
  8. const globalThis_js_1 = __importDefault(require("./globalThis.js"));
  9. function default_1(opts) {
  10. const xdomain = opts.xdomain;
  11. // XMLHttpRequest can be disabled on IE
  12. try {
  13. if ("undefined" !== typeof XMLHttpRequest && (!xdomain || has_cors_1.default)) {
  14. return new XMLHttpRequest();
  15. }
  16. }
  17. catch (e) { }
  18. if (!xdomain) {
  19. try {
  20. return new globalThis_js_1.default[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
  21. }
  22. catch (e) { }
  23. }
  24. }
  25. exports.default = default_1;