title: Creating a FixedUpdate in Typesript
body: <p>I'm working on a game-engine in typescript to learn some stuff. In Unity the way the fixed update works (in theory) is as follows:</p>
  
  <pre><code> var physicsTimeSimulated = 0;
   var lastUpdateTime = 0;    
  
   while (Unity is Running)
   {
       while (physicsTimeSimulated &lt; Time.time)
       {
           Engine.ExecutePhysicsStep();
           Engine.FixedUpdate(); // &lt;-- sent to all objects
           physicsTimeSimulated += physicsTimeStep;
       }
  
       deltaTime = Time.time - lastUpdateTime;
       Engine.RenderFrame();
       Engine.Update(); // &lt;-- sent to all objects
       lastUpdateTime = CurrentTime;
  
       // and repeat...
   }
  
  </code></pre>
  
  <p>What would be a good way to implement something like this in Typescript? The way I am doing the update function is as follows:</p>
  
  <pre><code>private fixedUpdateTiming: number = 1;
  private lastUpdate:number = Date.now();
  
  public Update(): void {
      while((Date.now() - this.lastUpdate) &gt; this.fixedUpdateTiming){
        this.onAppFixedUpdate.dispatch();
        this.lastUpdate = Date.now();
      }
  
      this.onAppUpdate.dispatch();
  
      window.requestAnimationFrame(() =&gt; {
        this.Update();
      });
    }
  </code></pre>
  
  <p>This way, there can be many updates per fixedupdate, but I can get only one fixedupdate per update.</p>
  
  <p>Thanks in advance, Steenbrink</p>