简体   繁体   中英

Callbacks after updating firebase data

When I update data in Firebase (either manually through the console, or through the web app), it seems that Firebase run some callbacks that make my retrieval app duplicate images.

The retrieval app queries data from Firebase, and put into a table:

var ref = firebase.database().ref("CURETALIASFREE/trial");
        ref.orderByChild("complete").equalTo("true")
           .on("value", function(snapshot) {
           // code that parse snapshot and put into a table.
        }

I have looked into network and consoles in the debug panel, but could not figure out why. 在此处输入图片说明

Any idea on how to fix this?

The on() method attaches the listener function and leaves it attached. The function is called once when attached and then again for any change to the location. If you only want the listener function to execute only one time, use once() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM