title: Loop forever and provide delta time
body: <p>I'm writing an HTML5 Game Development Javascript framework and I want to provide the user the difference in time between the last tick and the current one.</p>
  
  <pre><code>setInterval(tick, 16.6666666);
  
  function tick() {
    update();
    draw();
  }
  </code></pre>
  
  <p>That's what I have, but I want to have:</p>
  
  <pre><code>while (true) {
    /* Calculate delta time */
  
    tick(dt);
  }
  
  function tick(dt) {
    update(dt);
    draw();
  }
  </code></pre>
  
  <p>I tried that, using date.getTime(); to calculate delta time, but Firefox said the script crashed. Obviously, an infinite loop will crash. Got any suggestions for how I can go about this?</p>
  
  <p>I want an infinite loop, that can be stopped with <code>break</code>. I want to pass delta time too, but that I know how to do.</p>