mirror of
https://github.com/google/blockly.git
synced 2026-01-09 01:50:11 +01:00
Our files are up to a decade old, and have churned so much, that the initial author of the file no longer has much meaning. Furthermore, this will encourage developers to post to the developer group, rather than emailing Googlers (usually me) directly.
40 lines
812 B
JavaScript
40 lines
812 B
JavaScript
/**
|
|
* @license
|
|
* Copyright 2019 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview Provides a reference to the global object.
|
|
*/
|
|
'use strict';
|
|
|
|
/**
|
|
* Provides a reference to the global object.
|
|
* @namespace Blockly.utils.global
|
|
*/
|
|
goog.module('Blockly.utils.global');
|
|
|
|
|
|
/**
|
|
* Reference to the global object.
|
|
*
|
|
* More info on this implementation here:
|
|
* https://docs.google.com/document/d/1NAeW4Wk7I7FV0Y2tcUFvQdGMc89k2vdgSXInw8_nvCI
|
|
*/
|
|
exports.globalThis = (function() { // Not "let globalThis" to avoid shadowing.
|
|
if (typeof globalThis === 'object') {
|
|
return globalThis;
|
|
}
|
|
if (typeof self === 'object') {
|
|
return self;
|
|
}
|
|
if (typeof window === 'object') {
|
|
return window;
|
|
}
|
|
if (typeof global === 'object') {
|
|
return global;
|
|
}
|
|
return this;
|
|
})();
|