Files
blockly/tests/bootstrap_done.mjs
Maribeth Bottorff 88ff901a72 chore: use prettier instead of clang-format (#7014)
* chore: add and configure prettier

* chore: remove clang-format

* chore: remove clang-format config

* chore: lint additional ts files

* chore: fix lint errors in blocks

* chore: add prettier-ignore where needed

* chore: ignore js blocks when formatting

* chore: fix playground html syntax

* chore: fix yaml spacing from merge

* chore: convert text blocks to use arrow functions

* chore: format everything with prettier

* chore: fix lint unused imports in blocks
2023-05-10 16:01:39 -07:00

42 lines
1.3 KiB
JavaScript

/**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Finishes loading Blockly and exports it as this
* module's default export.
*
* It is exported as the default export to avoid having to
* re-export each property on Blockly individually, because you
* can't do:
*
* export * from <dynamically computed source>; // SYNTAX ERROR
*
* You must use a <script> tag to load prepare.js first, before
* importing this module in a <script type=module> to obtain the
* loaded value.
*
* See tests/playground.html for example usage.
*/
if (!window.bootstrapInfo) {
throw new Error(
'window.bootstrapInfo not found. ' +
'Make sure to load bootstrap.js before importing bootstrap_done.mjs.'
);
}
if (window.bootstrapInfo.compressed) {
// Compiled mode. Nothing more to do.
} else {
// Uncompressed mode. Use top-level await
// (https://v8.dev/features/top-level-await) to block loading of
// this module until goog.bootstrap()ping of Blockly is finished.
await window.bootstrapInfo.done;
// Note that this module previously did an export default of the
// value returned by the bootstrapInfo.done promise. This was
// changed in PR #5995 because library blocks and generators cannot
// be accessed via that the core/blockly.js exports object.
}