aboutsummaryrefslogtreecommitdiff
path: root/src/shell.html
blob: a41086b971471b9038670353a07d743bfcb32765 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>
  <head>
    <title>Emscripten-Generated Code</title>
  <body>
    <center>
      <canvas id='canvas' width='256' height='256'></canvas>
    </center>
    <hr>
    <div id='output'></div>
    <hr>
    <script type='text/javascript'>
      /**
       * TODO: Encapsulate this part in a reusable token such as
       *       EMSCRIPTEN_ENVIRONMENT so that we can share code
       *       between the default shell and custom ones.
       */
      // connect to canvas
      var Module = {
        print: (function() {
          var element = document.getElementById('output');
          return function(text) {
            text = text.replace(/</g, "&lt;");
            text = text.replace(/>/g, "&gt;");
            text = text.replace('\n', '<br>', 'g');
            element.innerHTML += text + '<br>';
          };
        })(),
        canvas: document.getElementById('canvas')
      };

      // The compiled code
      {{{ SCRIPT_CODE }}}
    </script>
  </body>
</html>