Skip to content

Instantly share code, notes, and snippets.

@sle-c
Created September 6, 2018 18:32
Show Gist options
  • Save sle-c/1637e679297cebbb7b5d288a2fe75bc6 to your computer and use it in GitHub Desktop.
Save sle-c/1637e679297cebbb7b5d288a2fe75bc6 to your computer and use it in GitHub Desktop.
Subscribe to firebase activities with counter
function handleActivitySubscription(snapshot) {
snapshot.docChanges().forEach(function(change) {
doSomething(change.doc.data());
});
}
const handleActivitySubscriptionWithCounter =
createFnCounter(handleActivitySubscription, 1);
db.collection("activities").where("userID", "==", currentUserID)
.onSnapshot(handleActivitySubscriptionWithCounter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment