Files
blockly/core/msg.js
Christopher Allen f9d0caa112 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
2021-09-14 14:39:29 +01:00

33 lines
732 B
JavaScript

/**
* @license
* Copyright 2013 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Empty name space for the Message singleton.
* @author scr@google.com (Sheridan Rawlins)
*/
'use strict';
/**
* Name space for the Msg singleton.
* Msg gets populated in the message files.
*/
goog.module('Blockly.Msg');
goog.module.declareLegacyNamespace();
const {globalThis} = goog.require('Blockly.utils.global');
/**
* Exported so that if Blockly is compiled with ADVANCED_COMPILATION,
* the Blockly.Msg object exists for message files included in script tags.
*/
if (!globalThis['Blockly']) {
globalThis['Blockly'] = {};
}
if (!globalThis['Blockly']['Msg']) {
globalThis['Blockly']['Msg'] = exports;
}