title: Typescript window.onload not being called after adding requirejs for phaser game
body: <p>I am trying to make a game with phaser and Typescript. I followed the instructions <a href="http://phaser.io/tutorials/how-to-use-phaser-with-typescript" rel="nofollow noreferrer">here</a> and it worked initialy. The problems came when I tried to modularise my code using AMD and requirejs</p>
  
  <h2>index.html</h2>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;Resonate&lt;/title&gt;
      &lt;link rel="stylesheet" href="app.css" type="text/css" /&gt;
      &lt;script src="phaser.js"&gt;&lt;/script&gt;
      &lt;script src="http://requirejs.org/docs/release/2.1.20/minified/require.js" data-main="app"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;RESONATE&lt;/h1&gt;
  
      &lt;div id="content"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <h2>Player.ts</h2>
  
  <pre><code>export class Player {
  
      color: string;
  
      constructor() {
          this.color = "#0000ff";
      }
  }
  </code></pre>
  
  <h2>app.ts</h2>
  
  <pre><code>import player = require("Player");
  
  class PhaserDemo {
  
      game: Phaser.Game;
  
      constructor() {
          this.game = new Phaser.Game(800, 600, Phaser.WEBGL, 'content', { preload: this.preload, create: this.create });
      }
  
      preload() {
          this.game.load.image('phaser_run', 'run.png');
      }
  
      create() {
          console.log("Before");
          var p = new player.Player();
          this.game.stage.backgroundColor = p.color;
      }
  }
  
  window.onload = () =&gt; {
      console.log("ONLOAD");
      var game = new PhaserDemo();
  };
  </code></pre>
  
  <p>Now when I load it up window.onload is never called, I tried following 
  <a href="https://stackoverflow.com/questions/29596886/window-onload-not-calling-function">window.onload not calling function</a>
  for the Javascript solution but I can't get it to work in typescript.</p>
  
  <p>Also here is the generated Javascript if you want to take a look <a href="https://gist.github.com/koreus7/06bee4a30d22bdc76d62" rel="nofollow noreferrer">https://gist.github.com/koreus7/06bee4a30d22bdc76d62</a></p>