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:
Andreas Hocevar
2016-07-10 12:46:48 +02:00
committed by GitHub
2 changed files with 12 additions and 1 deletions

View File

@@ -15,3 +15,5 @@
* @see http://www.w3.org/TR/pointerevents/#the-touch-action-css-property
*/
CSSProperties.prototype.touchAction;
var global;

View File

@@ -275,4 +275,13 @@ ol.inherits = function(childCtor, parentCtor) {
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;
}