Skip to content

Instantly share code, notes, and snippets.

@greggnakamura
Created June 24, 2014 04:49
Show Gist options
  • Save greggnakamura/c21736004a9306e1b4b5 to your computer and use it in GitHub Desktop.
Save greggnakamura/c21736004a9306e1b4b5 to your computer and use it in GitHub Desktop.
Firebase: snapshot functions
/* Firebase snapshot */
snapshot.val()
- Return values from Firebase at a given point in time
snapshot.hasChildren();
snapshot.hasChild('text');
snapshot.name();
- Get name of snapshot
snapshot.numChildren('text');
snapshot.forEach(function(item){
console.log(item.val());
console.log(item.name() + ' - ' + item.val());
console.log(item.ref()); // Firebase reference
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment