Merge pull request #5573 from ahocevar/safe-eval-global
Determine ol.global in a way that works in more environments
This commit is contained in:
@@ -15,3 +15,5 @@
|
|||||||
* @see http://www.w3.org/TR/pointerevents/#the-touch-action-css-property
|
* @see http://www.w3.org/TR/pointerevents/#the-touch-action-css-property
|
||||||
*/
|
*/
|
||||||
CSSProperties.prototype.touchAction;
|
CSSProperties.prototype.touchAction;
|
||||||
|
|
||||||
|
var global;
|
||||||
|
|||||||
+10
-1
@@ -275,4 +275,13 @@ ol.inherits = function(childCtor, parentCtor) {
|
|||||||
ol.nullFunction = function() {};
|
ol.nullFunction = function() {};
|
||||||
|
|
||||||
|
|
||||||
ol.global = Function('return this')();
|
/**
|
||||||
|
* @see https://github.com/tc39/proposal-global
|
||||||
|
*/
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
ol.global = window;
|
||||||
|
} else if (typeof global !== 'undefined') {
|
||||||
|
ol.global = global;
|
||||||
|
} else if (typeof self !== 'undefined') {
|
||||||
|
ol.global = self;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user