A DataSnapshot API contains data from a database location.
Any time you read data from the database, you receive the data as a DataSnapshot.
A DataSnapshot is an efficiently generated, immutable copy of the data at a database location.
It cannot be modified and will never change (to modify data, you always call the set() method on a reference directly).
-
ref.on( "value", function( snapshot ) {
-
The method
on() listens for data changes at a particular location.
This is the primary way to read data from a database.
Your callback will be triggered for the initial data and again whenever the data changes.
Use off() to stop receiving updates.
|
|
⇓ Showing user #1
|