In Firebase there is no concept of "finished" (when listening to "added child"). This is just a stream of data (imagine someone adding a new record before the original data is “finished”). You can use the value event to retrieve the entire object, but this will not give you new entries, as they are added as an added child.
If you really need to use a child and get notified when it is probably completed, you can set a timer. I do not know quickly, but here is the logic.
- Set up a child added event.
- Set a timer to call some finishedLoading () function in 500 ms.
- Each time the “added by child” event is triggered, destroy the timer set in the second step and create another one (that is, extend for another 500 ms).
When new data ceases to arrive, the timer will cease to expand, and finsihedLoading () will be called 500 ms later.
500 ms - this is just a number, use any costumes.
David gilbertson
source share