browser.js 781 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. // ref: https://github.com/tc39/proposal-global
  3. var getGlobal = function () {
  4. // the only reliable means to get the global object is
  5. // `Function('return this')()`
  6. // However, this causes CSP violations in Chrome apps.
  7. if (typeof self !== 'undefined') { return self; }
  8. if (typeof window !== 'undefined') { return window; }
  9. if (typeof global !== 'undefined') { return global; }
  10. throw new Error('unable to locate global object');
  11. }
  12. var globalObject = getGlobal();
  13. module.exports = exports = globalObject.fetch;
  14. // Needed for TypeScript and Webpack.
  15. if (globalObject.fetch) {
  16. exports.default = globalObject.fetch.bind(globalObject);
  17. }
  18. exports.Headers = globalObject.Headers;
  19. exports.Request = globalObject.Request;
  20. exports.Response = globalObject.Response;