Firebase onChildAdded for new data

前端 未结 2 1838
刺人心
刺人心 2020-12-11 04:37

If I have a list of 50,000 items stored in my firebase reference, and 5 items have been added to that list since the last time the client was online and listening, which cal

2条回答
  •  难免孤独
    2020-12-11 04:57

    You should use on('child_changed'). Normally, on() is used to listen for data changes at a particular location. However, on('child_changed') notifies you

    when the data stored in a child (or any of its descendants) changes.

    It will pass a data snapshot to the callback that contains the new child contents. Keep in mind that a single child_changed event may potentially represent multiple changes to the child.

提交回复
热议问题