You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
472 B

4 years ago
  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;