Tuesday, 20 August 2013

Firebase only updating on half my pages

Firebase only updating on half my pages

I'm new to Firebase and I'm trying to make a simple Texas Hold'em game.
Currently the game is viewed on your computer screen and you view your
cards and control your bets from your phone.
I can output the amount of chips that a player has on both the game screen
and their phone. However, when I manually change the amount of chips they
have in Forge it only updates on the game screen.
Heres the relevant code:
var player1Ref = new
Firebase('https://finalprojectcd.firebaseio.com/game/players/player1');
player1Ref.on('value', function (snapshot){
var chips = snapshot.val().chips;
console.log(chips);
$('#player1chips').html(chips);
})
The data on both the user's phone and game screen is just displayed by
referencing the id:
<p id='player2chips'></p>
I even tried add/changing value to update and it didnt make a difference.
Any ideas?

No comments:

Post a Comment