vendredi 28 avril 2017

javascript function dodging the if statement and going straight for the gold

I have an if statement that I am trying to use to attack a problem with async functions, everything works great when it works however that take multiple refreshes. The page errors out several times then finally displays the color i need. Below is just an example but on the server side once the client connects, the server is dodging my if statement and goes straight for function current(). Here is example of what its doing. I'd like to update the clients color based on colors from the server so if they chose the color green their choice comes back to the server, goes through a function and spits out a different color which then is sent back over to them, when it works. My issue is, Im completely dodging the if statement.

function ijoined() {
do this();
do that();
after doing this and that();
decide();
}

Decideds what color to display 
function decide() {
  if (yellow !== null) {
     start();
    console.log('I started');
  } else {
    current();
    console.log('I already started');
  }
} 

First color displayed for client
function start() {
      yellow = '545';
 }

Current color
function current() {
    var color id = clients color;
    var time = current time;
  }

Aucun commentaire:

Enregistrer un commentaire