utility class to help managing web workers
npm install @axc/thread-managershell
npm install @axc/thread-manager --save
`
Use
`javascript
// This example sends 'Hello world' and the worker sends it back to the main script so that its printed
//in your index.js
import {ThreadManager} from '@axc/thread-manager'
const TaskManager = new ThreadManager('./path/to/your/worker/script.js');
TaskManager.setMessageHandler = (e)=>{
console.log(e.data);
//yields 'Hello world'
}
TaskManager.sendMessage('Hello world');
//in your worker.js
onmessage = function(e) {
postMessage(e.data);
}
``