title: What is wrong with my JS webassemblity player?
body: <p>I am trying to port a C++ program to WASM using emscripten.</p>
  <p>The compilation process has been mastered, but so far with the presentation, which is bad ... I have
  problem:
  Uncaught ReferenceError: request is not defined</p>
  <pre><code>request.onload = function() {
  </code></pre>
  <p>Here is my script:</p>
  <pre><code>&lt;script type='text/javascript'&gt;
  request.onload = function() {
  var bytes = request.response;
  fetch('hello.wasm').then(response =&gt; 
  response.arrayBuffer()
  ).then(bytes =&gt;
  WebAssembly.instantiate(bytes, importObject)
  ).then(results =&gt; {
  // Do something with the results!
  console.log(results);
  });
  };
     
     
  var statusElement = document.getElementById('status');
  var progressElement = document.getElementById('progress');
  var spinnerElement = document.getElementById('spinner');
   
  var Module = {
  preRun: [],
  postRun: [],
  print: (function() {
  var element = document.getElementById('output');
  if (element) element.value = ''; // clear browser cache
  return function(text) {
  if (arguments.length &gt; 1) text =  Array.prototype.slice.call(arguments).join(' ');
  // These replacements are necessary if you render to raw HTML
  //text = text.replace(/&amp;/g, &quot;&amp;amp;&quot;);
  //text = text.replace(/&lt;/g, &quot;&amp;lt;&quot;);
  //text = text.replace(/&gt;/g, &quot;&amp;gt;&quot;);
  //text = text.replace('\n', '&lt;br&gt;', 'g');
  console.log(text);
  if (element) {
  element.value += text + &quot;\n&quot;;
  element.scrollTop = element.scrollHeight; // focus on bottom
  }
  };
  })(),
  canvas: (function() {
  var canvas = document.getElementById('canvas');
  
  // As a default initial behavior, pop up an alert when webgl context is lost. To make your
  // application robust, you may want to override this behavior before shipping!
  // See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
  canvas.addEventListener(&quot;webglcontextlost&quot;, function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
  
  return canvas;
  })(),
  setStatus: function(text) {
  if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
  if (text === Module.setStatus.last.text) return;
  var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
  var now = Date.now();
  if (m &amp;&amp; now - Module.setStatus.last.time &lt; 30) return; // if this is a progress update, skip it if too soon
  Module.setStatus.last.time = now;
  Module.setStatus.last.text = text;
  if (m) {
  text = m[1];
  progressElement.value = parseInt(m[2])*100;
  progressElement.max = parseInt(m[4])*100;
  progressElement.hidden = false;
  spinnerElement.hidden = false;
  } else {
  progressElement.value = null;
  progressElement.max = null;
  progressElement.hidden = true;
  if (!text) spinnerElement.style.display = 'none';
  }
  statusElement.innerHTML = text;
  },
  totalDependencies: 0,
  monitorRunDependencies: function(left) {
  this.totalDependencies = Math.max(this.totalDependencies, left);
  Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
  }
  };
  Module.setStatus('Downloading...');
  window.onerror = function(event) {
  // TODO: do not warn on ok events like simulating an infinite loop or exitStatus
  Module.setStatus('Exception thrown, see JavaScript console');
  spinnerElement.style.display = 'none';
  Module.setStatus = function(text) {
  if (text) Module.printErr('[post-exception status] ' + text);
  };
  };
  
     
  &lt;/script&gt;
  </code></pre>
  <p>(updated: right code) here is my source of testing site:
  <a href="https://www.dropbox.com/sh/elgdplx8xmvp51g/AAC-M0oCrA0_rgWZfrRvMt8na?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/sh/elgdplx8xmvp51g/AAC-M0oCrA0_rgWZfrRvMt8na?dl=0</a> look at hello.html</p>