mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
Migrate core.global.js to named exports (#5451)
This is part of #5153 but is being prioritised because we want remove the declareLegacyNamespace calls from the core/utils/*.js modules and then reexport them explicitly via utils.js, and it turns out that doing so results in the exports object of this module being passed to Object.freeze - which fails on the global object, which can't be made non-extensible! The new name chosen for the former default export is globalThis, since it is intended to have the same value as the global variable of that name; see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
This commit is contained in:
committed by
GitHub
parent
09fb59f6ee
commit
f9d0caa112
@@ -28,7 +28,7 @@ const Rect = goog.require('Blockly.utils.Rect');
|
||||
const WorkspaceSvg = goog.requireType('Blockly.WorkspaceSvg');
|
||||
const colourUtils = goog.require('Blockly.utils.colour');
|
||||
const deprecation = goog.require('Blockly.utils.deprecation');
|
||||
const global = goog.require('Blockly.utils.global');
|
||||
const {globalThis} = goog.require('Blockly.utils.global');
|
||||
const idGenerator = goog.require('Blockly.utils.idGenerator');
|
||||
const internalConstants = goog.require('Blockly.internalConstants');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
@@ -433,7 +433,7 @@ const is3dSupported = function() {
|
||||
}
|
||||
// CC-BY-SA Lorenzo Polidori
|
||||
// stackoverflow.com/questions/5661671/detecting-transform-translate3d-support
|
||||
if (!global['getComputedStyle']) {
|
||||
if (!globalThis['getComputedStyle']) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ const is3dSupported = function() {
|
||||
for (let t in transforms) {
|
||||
if (el.style[t] !== undefined) {
|
||||
el.style[t] = 'translate3d(1px,1px,1px)';
|
||||
const computedStyle = global['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
|
||||
|
||||
Reference in New Issue
Block a user