Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use top level await in Sandcastle #11060

Merged
merged 2 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Apps/Sandcastle/Sandcastle-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
window.embedInSandcastleTemplate = function (code, addExtraLine) {
return (
`${
"window.startup = function (Cesium) {\n" +
"window.startup = async function (Cesium) {\n" +
" 'use strict';\n" +
"//Sandcastle_Begin\n"
}${addExtraLine ? "\n" : ""}${code}//Sandcastle_End\n` +
` Sandcastle.finishedLoading();\n` +
`};\n` +
`if (typeof Cesium !== 'undefined') {\n` +
` window.startupCalled = true;\n` +
` window.startup(Cesium);\n` +
` window.startup(Cesium).catch((error) => {\n` +
` console.error(error);\n` +
` });\n` +
`}\n`
);
};
Expand Down
9 changes: 6 additions & 3 deletions Apps/Sandcastle/gallery/3D Models Coloring.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
</table>
</div>
<script id="cesium_sandcastle_script">
window.startup = function (Cesium) {
window.startup = async function (Cesium) {
"use strict";
//Sandcastle_Begin
const viewer = new Cesium.Viewer("cesiumContainer", {
Expand Down Expand Up @@ -322,11 +322,14 @@
});

//Sandcastle_End
Sandcastle.finishedLoading();
};
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
window.startup(Cesium);
window.startup(Cesium).catch((error) => {
"use strict";
console.error(error);
});
Sandcastle.finishedLoading();
}
</script>
</body>
Expand Down
9 changes: 6 additions & 3 deletions Apps/Sandcastle/gallery/3D Models.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
window.startup = function (Cesium) {
window.startup = async function (Cesium) {
"use strict";
//Sandcastle_Begin
const viewer = new Cesium.Viewer("cesiumContainer", {
Expand Down Expand Up @@ -169,11 +169,14 @@

Sandcastle.addToolbarMenu(options);
//Sandcastle_End
Sandcastle.finishedLoading();
};
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
window.startup(Cesium);
window.startup(Cesium).catch((error) => {
"use strict";
console.error(error);
});
Sandcastle.finishedLoading();
}
</script>
</body>
Expand Down
9 changes: 6 additions & 3 deletions Apps/Sandcastle/gallery/3D Tiles Adjust Height.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<input type="text" size="5" data-bind="value: height" />
</div>
<script id="cesium_sandcastle_script">
window.startup = function (Cesium) {
window.startup = async function (Cesium) {
"use strict";
//Sandcastle_Begin
const viewer = new Cesium.Viewer("cesiumContainer", {
Expand Down Expand Up @@ -121,11 +121,14 @@
});

//Sandcastle_End
Sandcastle.finishedLoading();
};
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
window.startup(Cesium);
window.startup(Cesium).catch((error) => {
"use strict";
console.error(error);
});
Sandcastle.finishedLoading();
}
</script>
</body>
Expand Down
9 changes: 6 additions & 3 deletions Apps/Sandcastle/gallery/3D Tiles BIM.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
window.startup = function (Cesium) {
window.startup = async function (Cesium) {
"use strict";
//Sandcastle_Begin
// Power Plant design model provided by Bentley Systems
Expand Down Expand Up @@ -217,11 +217,14 @@
processTileFeatures(tile, unloadFeature);
});
//Sandcastle_End
Sandcastle.finishedLoading();
};
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
window.startup(Cesium);
window.startup(Cesium).catch((error) => {
"use strict";
console.error(error);
});
Sandcastle.finishedLoading();
}
</script>
</body>
Expand Down
9 changes: 6 additions & 3 deletions Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
window.startup = function (Cesium) {
window.startup = async function (Cesium) {
"use strict";
//Sandcastle_Begin

Expand Down Expand Up @@ -212,11 +212,14 @@
feature.show = false;
}, Cesium.ScreenSpaceEventType.MIDDLE_CLICK);
//Sandcastle_End
Sandcastle.finishedLoading();
};
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
window.startup(Cesium);
window.startup(Cesium).catch((error) => {
"use strict";
console.error(error);
});
Sandcastle.finishedLoading();
}
</script>
</body>
Expand Down
9 changes: 6 additions & 3 deletions Apps/Sandcastle/gallery/3D Tiles Clipping Planes.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</div>

<script id="cesium_sandcastle_script">
window.startup = function (Cesium) {
window.startup = async function (Cesium) {
"use strict";
//Sandcastle_Begin
// Add a clipping plane, a plane geometry to show the representation of the
Expand Down Expand Up @@ -343,11 +343,14 @@
}

//Sandcastle_End
Sandcastle.finishedLoading();
};
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
window.startup(Cesium);
window.startup(Cesium).catch((error) => {
"use strict";
console.error(error);
});
Sandcastle.finishedLoading();
}
</script>
</body>
Expand Down
9 changes: 6 additions & 3 deletions Apps/Sandcastle/gallery/3D Tiles Compare.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
window.startup = function (Cesium) {
window.startup = async function (Cesium) {
"use strict";
//Sandcastle_Begin
const viewer = new Cesium.Viewer("cesiumContainer");
Expand Down Expand Up @@ -106,11 +106,14 @@
moveActive = false;
}, Cesium.ScreenSpaceEventType.PINCH_END);
//Sandcastle_End
Sandcastle.finishedLoading();
};
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
window.startup(Cesium);
window.startup(Cesium).catch((error) => {
"use strict";
console.error(error);
});
Sandcastle.finishedLoading();
}
</script>
</body>
Expand Down
Loading