# HTTPSceneLoader onReady being called once for each object

**URL:** https://discourse.vtk.org/t/httpsceneloader-onready-being-called-once-for-each-object/6252
**Category:** Web
**Created:** [July 27, 2021, 7:22pm UTC](https://discourse.vtk.org/t/httpsceneloader-onready-being-called-once-for-each-object/6252 "2021-07-27T19:22:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Nicolas\_Schmidt](https://discourse.vtk.org/user_avatar/discourse.vtk.org/nicolas_schmidt/32/3681_2.png) [@Nicolas\_Schmidt](https://discourse.vtk.org/u/Nicolas_Schmidt)
#### Post date: [July 27, 2021, 7:22pm UTC](https://discourse.vtk.org/t/httpsceneloader-onready-being-called-once-for-each-object/6252/1 "2021-07-27T19:22:17Z")

</div>

Using the HTTPSceneLoader onReady function [as in this codesandbox](https://codesandbox.io/s/react-vtk-4l0s8?file=/src/App.js) results in sceneImporter’s onReady function (line 227) being called multiple times. It looks like it’s being called 1 per object in the scene, but the whole scene is accessible in each call.

I would think onReady would either be called after each object has finished loading, or once after the whole scene has loaded. Right now it seems as if it’s being called once for each object with the whole scene. Am I misusing or misunderstanding this function at all?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [July 29, 2021, 5:41pm UTC](https://discourse.vtk.org/t/httpsceneloader-onready-being-called-once-for-each-object/6252/2 "2021-07-29T17:41:41Z")

</div>

It is indeed called every time an item in the scene is ready.  
You will have to count the ready calls and the scene length to know when you reach the end of the loading.

---

<div class="post-metadata">

### Author: ![Nicolas\_Schmidt](https://discourse.vtk.org/user_avatar/discourse.vtk.org/nicolas_schmidt/32/3681_2.png) [@Nicolas\_Schmidt](https://discourse.vtk.org/u/Nicolas_Schmidt)
#### Post date: [July 30, 2021, 1:43pm UTC](https://discourse.vtk.org/t/httpsceneloader-onready-being-called-once-for-each-object/6252/3 "2021-07-30T13:43:13Z")

</div>

Ok sounds good, thanks @Sebastien.
