title: Pooling Web Workers
body: <p>Does anyone know of good patterns/libraries for pooling Web Workers?</p>
  
  <p>I want to be able to do something like the following:</p>
  
  <ul>
  <li>Set a maximum number of threads.</li>
  <li>The first time I ask for a Worker it creates a new one.</li>
  <li>The next time it will return the previous Worker, unless it is still completing operations, in which case it will create a new one and return that.</li>
  <li>Once we hit the maximum it starts queuing requests for workers up and starting them when a Worker becomes available.</li>
  <li>This currently assumes the pool would all use the same .js file.</li>
  </ul>
  
  <p>Or is there a better approach to this?</p>