global.js 472 B

1234567891011121314151617181920
  1. var g;
  2. // This works in non-strict mode
  3. g = (function() {
  4. return this;
  5. })();
  6. try {
  7. // This works if eval is allowed (see CSP)
  8. g = g || new Function("return this")();
  9. } catch (e) {
  10. // This works if the window reference is available
  11. if (typeof window === "object") g = window;
  12. }
  13. // g can still be undefined, but nothing to do about it...
  14. // We return undefined, instead of nothing here, so it's
  15. // easier to handle this case. if(!global) { ...}
  16. module.exports = g;