title: How to integrate typescript project with html
body: <p>I want to call a typescript function from the HTML body. However, I am unable to call my function(D2O_main()) from HTML as I don't fully understand the generated js code. Any help is greatly appreciated.</p>
  
  <p>I generated the js using the following command:
  tsc --module umd main.ts</p>
  
  <p>Here's the html file.</p>
  
  <p></p>
  
  <pre><code>&lt;head&gt;
      &lt;script type="text/javascript" src="main.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="D2O_main();"&gt;
      &lt;canvas id="canvas-001"&gt;&lt;/canvas&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here's the main.ts file:</p>
  
  <pre><code>import {Init} from "./Core/IO/Init"
  let init:Init;
  function D2O_main() {
      init = new Init("canvas-001");
  }
  </code></pre>
  
  <p>Here's the generated main.js file:</p>
  
  <pre><code>(function (factory) {
      if (typeof module === "object" &amp;&amp; typeof module.exports === "object") {
          var v = factory(require, exports);
          if (v !== undefined) module.exports = v;
      }
      else if (typeof define === "function" &amp;&amp; define.amd) {
          define(["require", "exports", "./Core/IO/Init"], factory);
      }
  })(function (require, exports) {
      "use strict";
      exports.__esModule = true;
      var Init_1 = require("./Core/IO/Init");
      var init;
      function D2O_main() {
          init = new Init_1.Init("canvas-001");
      }
  });
  </code></pre>
  
  <p>I'm getting the following error at the browser console:</p>
  
  <p>Uncaught ReferenceError: D2O_main is not defined
      at onload</p>
  
  <p>Once again, any help is greatly appreciated.</p>