PointlessCoder
PointlessCoder

Reputation: 3

How do I pull data from google firebase whenever I want?

I want to pull data from a firebase database that I have made, I know that you can get the data when with the .on('value', snapshot =>{...}), but that won't work because I want to pull data whenever I want without being restricted to the.on('value', snapshot =>{...}) "event"(or whatever it is called)

Thanks in advance!

Upvotes: 0

Views: 41

Answers (1)

abeyaz
abeyaz

Reputation: 3164

You have to use once method for that. This way, you just fetch data at the time being.

database.ref('...').once('value', function(snapshot){
     // same way as .on method
})

Upvotes: 1

Related Questions