title: Using transferable objects from a Web Worker
body: <p>I currently have this code to create a Web Worker:</p>
  
  <pre><code>w = new Worker("webwork.js");
  w.onmessage = function(event) { alert(event.data); }
  </code></pre>
  
  <p>And then the <code>webwork.js</code> code for the Web Worker:</p>
  
  <pre><code>self.onmessage = function(event) {
      //var ss=r;  //Causes error because of undefined
      var ss="";
      for(var currProp in event) {
          ss+=("event."+currProp+"="+event[currProp]+"\n");
      }
      postMessage(ss);
  }
  </code></pre>
  
  <p>Now I want to transfer a 128-Megabyte <code>ArrayBuffer</code> with this code:</p>
  
  <pre><code>var r = new ArrayBuffer(1048576*128);
  w.postMessage(0, [r]);
  </code></pre>
  
  <hr>
  
  <p>Now that I have supposedly transferred the variable <code>r</code>, how do I access it from the Web Worker itself. I have tried <code>event.r</code>, just <code>r</code>, <code>self.r</code> and other things like trying to add a second function argument for the array of <code>ArrayBuffers</code>, but nothing works.</p>
  
  <p>How can I access the transferred variable(s) from the Web Worker?</p>