WebWorkers are awesome! Unfortionately, Google Chrome doesn't support creating subworkers, here's the Chromium issue for it.
This polyfill provides this functionality to Chrome and any other browser that supports WebWorkers, but now subworkers.
Using this is easy!
-
Download
subworkers.js
-
In the document hosting the WebWorkers, include the
subworkers.js
script before any scripts that create WebWorkers.<script src="subworkers.js"></script>
-
In the code for any WebWorker that will have a subworker, you also need to include
subworkers.js
.importScripts("subworkers.js");
That's it! WebWorkers now work the way you would expect!
This project is released under the MIT License.