Skip to content

Commit

Permalink
Use top level await in Sandcastle
Browse files Browse the repository at this point in the history
  • Loading branch information
ggetz committed Feb 2, 2023
1 parent b5233df commit ef5db9b
Show file tree
Hide file tree
Showing 244 changed files with 4,713 additions and 4,281 deletions.
8 changes: 6 additions & 2 deletions Apps/Sandcastle/Sandcastle-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
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` +
` try {\n` +
` window.startup(Cesium);\n` +
` } 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

0 comments on commit ef5db9b

Please sign in to comment.