Multi.js is cross browsing JavaScript multithread library.
npm install multijs1. Install module via NPM
> $ npm install --save multi.js
2. Include from browser script. You need Web bundler(Browserify/Webpack) and transpiler like Babel.
``javascript
import Thread from 'multijs';
var thread = new Thread(function() {
postData = Math.PI * postData;
return postData;
});
thread.start().execute(100, function(err, data) {
if(err) {
console.log(err);
return;
}
console.log(data);
thread.terminate();
});
``
3. Build and run.