You are reading a single comment by @rsm and its replies. Click here to read the full conversation.
  • Thanks Gordon. The up-arrow trick works well to see the code sent by Blockly. I'm not sure how to open the 'inspect element' window.

    You're also right about the two calls happening at the same time. I read up on setTimeout() and see that it actually forks a new process that is executed at the specified time. But it is non-blocking. Is there a way to block? I tried writing a sleep() function, but that's not working either (see below). I also read that there's a way to get setTimeout() to work the way I want, but I can't get it to work.

    Thanks,
    Rehman

    function sleep(milliseconds) {
      var start =  getTime();
      var i = 0;
      for (i = 0; i < 1e7; i++) {
        if ( ( getTime() - start) > milliseconds){
          break;
        }
      }
    }
    
About

Avatar for rsm @rsm started