Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var database = firebase.database();
- database.ref().on("value", function(snapshot) {
- console.log("Logging snapshot.val " + snapshot.val());
- console.log("Logging hits " + snapshot.val().hits);
- var hitCounter = snapshot.val().hits;
- console.log("hitCounter is " + hitCounter)
- }, function(errorObject) {
- console.log("The read failed: " + errorObject.code);
- });
- //so I can get it to display the value in the database, but not to increase. WTF
- function showStuff() {
- $("#content").fadeIn("slow");
- hitCounter++;
- console.log("hitCounter in showstuff() function is = " + hitCounter);
- //this console log above doesn't even fire. WTF!?
- //Ask on stack overflow some other time
- database.ref().set({
- hits: hitCounter
- });
- }
Add Comment
Please, Sign In to add comment