This file contains hidden or 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
| function go() { | |
| var userId = prompt('Username?', 'Guest'); | |
| checkIfUserExists(userId); | |
| } | |
| var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users'; | |
| function userExistsCallback(userId, exists) { | |
| if (exists) { | |
| alert('user ' + userId + ' exists!'); |
This file contains hidden or 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
| function makeList(ref) { | |
| var fruits = ["banana", "apple", "grape", "orange"]; | |
| for (var i = 0; i < fruits.length; i++) { | |
| ref.push(fruits[i]); | |
| } | |
| } | |
| function getFirstFromList(ref, cb) { | |
| ref.startAt().limit(1).once("child_added", function(snapshot) { | |
| cb(snapshot.val()); |