forked from bazaarvoice/bv-ui-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
16 lines (14 loc) · 640 Bytes
/
Copy pathindex.js
File metadata and controls
16 lines (14 loc) · 640 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
* @fileOverview Provides a reference to the global object
* the below solution works in ES3+ environment and doesn't violates CSP in Chrome apps
* see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
*/
'use strict'; /* eslint strict:0 */
var getGlobal = function () {
if (typeof globalThis !== 'undefined') { return globalThis; }
if (typeof window !== 'undefined') { return window; }
if (typeof self !== 'undefined') { return self; }
if (typeof global !== 'undefined') { return global; }
throw new Error('unable to locate global object');
};
module.exports = getGlobal();