title: Does self.close actually kill the web worker thread?
body: <p>See this example:</p>
  <pre class="lang-js prettyprint-override"><code>// CLOSEWORKER.JS:
  
  self.postMessage('foo');
  self.close();
  self.postMessage('bar');
  setTimeout(() =&gt; self.postMessage('baz'), 0);
  
  // MAIN.JS:
  
  const worker = new Worker('./worker.js');
  worker.onmessage = ({data}) =&gt; console.log(data);
  </code></pre>
  <p>Even if I have invoked <code>self.close()</code>,the next line <code>self.postMessage('bar');</code> still executed and log 'bar'.I can't understand that since the close method should just kill the worker thread right after being called.</p>
  <p>Also ,see another example:</p>
  <pre class="lang-js prettyprint-override"><code>TERMINATEWORKER.JS:
  
  self.onmessage = ({data}) =&gt; console.log(data);
  
  MAIN.JS:
  
  const worker = new Worker('./worker.js');
  setTimeout(() =&gt; {
   worker.postMessage('foo');
   worker.terminate();
   worker.postMessage('bar');
   setTimeout(() =&gt; worker.postMessage('baz'), 0);
  }, 1000)
  </code></pre>
  <p>When using the <code>terminate</code> method instead of the <code>close</code> method, the code executed as I expected. It just logs 'foo', no-log any other thing, which suggests that the thread has been killed right after calling the <code>terminate</code> method.</p>