index.browser.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.URLSearchParams = exports.URL = exports.Headers = exports.Response = exports.Request = exports.fetch = void 0;
  4. if (!global) {
  5. global = self;
  6. }
  7. let { fetch, Request, Response, Headers, URL, URLSearchParams } = global;
  8. exports.fetch = fetch;
  9. exports.Request = Request;
  10. exports.Response = Response;
  11. exports.Headers = Headers;
  12. exports.URL = URL;
  13. exports.URLSearchParams = URLSearchParams;
  14. exports.fetch = fetch = fetch.bind(global);
  15. if (!global.process) {
  16. global.process = {};
  17. }
  18. if (!global.process.env) {
  19. global.process.env = {
  20. NODE_ENV: typeof app !== 'undefined' ? app.env : 'production',
  21. };
  22. }
  23. if (!global.process.version) {
  24. global.process.version = '';
  25. }
  26. if (!global.process.hrtime) {
  27. global.process.hrtime = function hrtime(previousTimestamp) {
  28. var clocktime = Date.now() * 1e-3;
  29. var seconds = Math.floor(clocktime);
  30. var nanoseconds = Math.floor((clocktime % 1) * 1e9);
  31. if (previousTimestamp) {
  32. seconds = seconds - previousTimestamp[0];
  33. nanoseconds = nanoseconds - previousTimestamp[1];
  34. if (nanoseconds < 0) {
  35. seconds--;
  36. nanoseconds += 1e9;
  37. }
  38. }
  39. return [seconds, nanoseconds];
  40. };
  41. }
  42. if (!global.os) {
  43. global.os = {};
  44. }
  45. //# sourceMappingURL=index.browser.js.map