Created
February 2, 2016 21:51
-
-
Save ltk/ba19abf0bb9dfe5eafe6 to your computer and use it in GitHub Desktop.
BaaS at Scale | Update Subscription Granularity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method 1: High Data Usage | |
// ========================= | |
const rootReference = new Firebase(firebaseUrl) | |
const itemsReference = rootReference.child('items') | |
itemsReference.on('value', function(data) { | |
// Update the UI with the items update | |
}) | |
// Method 2: Low Data Usage | |
// ======================== | |
const rootReference = new Firebase(firebaseUrl) | |
const itemIds = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r"] | |
itemIds.forEach((itemId) => { | |
const itemReference = rootReference.child(`items/${itemId}`) | |
itemReference.on('value', function(data) { | |
// Update the UI with the item update | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment