mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
chore: Remove Blockly.utils.global (#6120)
The Closure Compiler creates globalThis as a pollyfill.
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* @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');
|
||||
|
||||
|
||||
/* eslint-disable no-undef, no-invalid-this */
|
||||
|
||||
/**
|
||||
* 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;
|
||||
})();
|
||||
@@ -16,7 +16,6 @@
|
||||
goog.module('Blockly.utils.svgMath');
|
||||
|
||||
const deprecation = goog.require('Blockly.utils.deprecation');
|
||||
const global = goog.require('Blockly.utils.global');
|
||||
const style = goog.require('Blockly.utils.style');
|
||||
const userAgent = goog.require('Blockly.utils.userAgent');
|
||||
const {Coordinate} = goog.require('Blockly.utils.Coordinate');
|
||||
@@ -130,7 +129,7 @@ const is3dSupported = function() {
|
||||
}
|
||||
// CC-BY-SA Lorenzo Polidori
|
||||
// stackoverflow.com/questions/5661671/detecting-transform-translate3d-support
|
||||
if (!global.globalThis['getComputedStyle']) {
|
||||
if (!globalThis['getComputedStyle']) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -150,7 +149,7 @@ const is3dSupported = function() {
|
||||
for (const t in transforms) {
|
||||
if (el.style[t] !== undefined) {
|
||||
el.style[t] = 'translate3d(1px,1px,1px)';
|
||||
const computedStyle = global.globalThis['getComputedStyle'](el);
|
||||
const computedStyle = globalThis['getComputedStyle'](el);
|
||||
if (!computedStyle) {
|
||||
// getComputedStyle in Firefox returns null when Blockly is loaded
|
||||
// inside an iframe with display: none. Returning false and not
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
*/
|
||||
goog.module('Blockly.utils.userAgent');
|
||||
|
||||
const {globalThis} = goog.require('Blockly.utils.global');
|
||||
|
||||
|
||||
/**
|
||||
* The raw useragent string.
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
*/
|
||||
goog.module('Blockly.utils.xml');
|
||||
|
||||
const {globalThis} = goog.require('Blockly.utils.global');
|
||||
|
||||
|
||||
/**
|
||||
* Namespace for Blockly's XML.
|
||||
|
||||
Reference in New Issue
Block a user