I need some callback function!

Hello. I need some help.
It’s my first Javascript project in my life, so It can be very frustrating.
But I hope you can answer me please.

As on title, I need some callback function when the background map(CesiumIon) is loaded.
How can I know the map is fully loaded? I need some getHeight function.
From now on, I use setTimeout to waiting the map. But it is not a smart solution, doesn’t it?

I’m waiting your reply.
Thank you for reading.

You can listen to some the tileLoadProgressEvent on the Globe:

viewer.scene.globe.tileLoadProgressEvent.addEventListener(
	(numberOfRemainingTiles) => {
		if (this.viewer.scene.globe.tilesLoaded) {
			// do your height thing
		}
	},
)

See the docs: Globe - Cesium Documentation

1 Like

Thank you^^

You’re my life savior!