# I need some callback function!

**URL:** <https://community.cesium.com/t/i-need-some-callback-function/26835>\
**Category:** CesiumJS\
**Created:** [September 19, 2023, 12:01am UTC](https://community.cesium.com/t/i-need-some-callback-function/26835 "2023-09-19T00:01:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dizzyto](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/dizzyto/32/14037_2.png) [@dizzyto](https://community.cesium.com/u/dizzyto)\
**Post date:** [September 19, 2023, 12:01am UTC](https://community.cesium.com/t/i-need-some-callback-function/26835/1 "2023-09-19T00:01:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anneg](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/anneg/32/11217_2.png) [@anneg](https://community.cesium.com/u/anneg)\
**Post date:** [September 20, 2023, 1:10pm UTC](https://community.cesium.com/t/i-need-some-callback-function/26835/2 "2023-09-20T13:10:43Z")

</div>

You can listen to some the `tileLoadProgressEvent` on the `Globe`:

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

```

See the docs: [Globe - Cesium Documentation](https://cesium.com/learn/cesiumjs/ref-doc/Globe.html?classFilter=globe#tileLoadProgressEvent)

---

<div class="post-metadata">

**Author:** ![dizzyto](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/dizzyto/32/14037_2.png) [@dizzyto](https://community.cesium.com/u/dizzyto)\
**Post date:** [September 25, 2023, 1:17am UTC](https://community.cesium.com/t/i-need-some-callback-function/26835/3 "2023-09-25T01:17:20Z")

</div>

Thank you^^

You’re my life savior!
