# How do you get the state when the model is fully loaded

**URL:** <https://forum.techsoft3d.com/t/how-do-you-get-the-state-when-the-model-is-fully-loaded/2043>\
**Category:** HOOPS Visualize Web\
**Tags:** webviewer, how-to\
**Created:** [May 19, 2023, 9:50am UTC](https://forum.techsoft3d.com/t/how-do-you-get-the-state-when-the-model-is-fully-loaded/2043 "2023-05-19T09:50:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![erduowang1995](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@erduowang1995](https://forum.techsoft3d.com/u/erduowang1995)\
**Post date:** [May 19, 2023, 9:50am UTC](https://forum.techsoft3d.com/t/how-do-you-get-the-state-when-the-model-is-fully-loaded/2043/1 "2023-05-19T09:50:40Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/2X/0/09d1e00d9325c0d0456e9007e622c8d5e0517cfd.png)

modelStructureLoadEnd has been deprecated, what is the way to know when the model is loaded?

---

<div class="post-metadata">

**Author:** ![guido](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.techsoft3d.com/guido/32/115_2.png) [@guido](https://forum.techsoft3d.com/u/guido)\
**Post date:** [May 19, 2023, 11:38am UTC](https://forum.techsoft3d.com/t/how-do-you-get-the-state-when-the-model-is-fully-loaded/2043/2 "2023-05-19T11:38:13Z")

</div>

Because the model might be streaming interactively and some data might be left on the server, it is not always clear what “fully loaded” means. The `modelStructureReady’ callback lets you know that the model structure data is fully loaded and the model can be interacted with and queried. You can also use the function below to determine if the viewer has reached an idle state, which generally means that loading has ended.

` await hwv.waitForIdle();`

---

<div class="post-metadata">

**Author:** ![erduowang1995](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@erduowang1995](https://forum.techsoft3d.com/u/erduowang1995)\
**Post date:** [May 22, 2023, 3:32am UTC](https://forum.techsoft3d.com/t/how-do-you-get-the-state-when-the-model-is-fully-loaded/2043/3 "2023-05-22T03:32:54Z")

</div>

My goal is actually to know and print the load time of the model. Is there any way to get the complete load time of the model directly?  
Currently, I found that the streamingDeactivated callback function triggered twice, once before and once after model loading. I printed the interval between the two times through console.time(). Can this time be regarded as the complete loading time of the model?

---

<div class="post-metadata">

**Author:** ![guido](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.techsoft3d.com/guido/32/115_2.png) [@guido](https://forum.techsoft3d.com/u/guido)\
**Post date:** [May 22, 2023, 12:02pm UTC](https://forum.techsoft3d.com/t/how-do-you-get-the-state-when-the-model-is-fully-loaded/2043/4 "2023-05-22T12:02:36Z")

</div>

Yes, that should largely work with the caveat that because streaming has stopped does not necessarily mean that the model is fully on the client. Alternatively can start the timer in the sceneReady callback and then stop it after the waitForIdle promise has been fulfilled.

---

<div class="post-metadata">

**Author:** ![erduowang1995](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@erduowang1995](https://forum.techsoft3d.com/u/erduowang1995)\
**Post date:** [May 24, 2023, 2:04am UTC](https://forum.techsoft3d.com/t/how-do-you-get-the-state-when-the-model-is-fully-loaded/2043/5 "2023-05-24T02:04:44Z")

</div>

Ok, thanks for your reply
