Polyfill to allow nested WebWorkers Edit
npm install subworkersThis polyfill provides this functionality to Chrome and any other browser that supports WebWorkers,
but not subworkers. This functionality is implemented by creating all subworkers in the context of
the main page and simulating the communication.
1. Download subworkers.js
2. In the document hosting the WebWorkers, include the subworkers.js script before any scripts that create WebWorkers.
`` html`
3. In the code for any WebWorker that will have a subworker, you also need to include subworkers.js.
` javascript`
importScripts("subworkers.js");
That's it! WebWorkers now work the way you would expect!
1. Install subworkers.js by running npm install -s subworkers
2. Import the library in all scripts
` javascript``
require('subworkers'); // CommonJS
// or
import 'subworkers'; // ES2015+