Skip to content

Instantly share code, notes, and snippets.

View bommels's full-sized avatar
:octocat:
Hello world

Terry bommels

:octocat:
Hello world
View GitHub Profile
@bommels
bommels / firebase_snapshot_parent.js
Created November 10, 2016 21:20 — forked from anantn/firebase_snapshot_parent.js
Firebase: Get the parent of a snapshot.
function getParent(snapshot) {
// You can get the reference (A Firebase object) from a snapshot
// using .ref().
var ref = snapshot.ref;
// Now simply find the parent and return the name.
return ref.parent.key;
}
var testRef = new Firebase("https://example.firebaseIO-demo.com/foo/bar");
testRef.once("child_added", function(snapshot) {