Execute inline JavaScript with a Web Worker API polyfill.
Installation is available using Bower.
bower install cloudkid-worker
var workerCode = "this.onmessage = function(event)" +
"{" +
"var data = event.data;" +
"var returnVal = data.value * data.value;" +
"this.postMessage(returnVal);" +
"};";
// Create the worker
var worker = cloudkid.Worker.init(workerCode);
worker.onmessage = function(e)
{
console.log(e.data); // returns 400
};
// Start the worker.
worker.postMessage({value:20});
Copyright (c) 2015 CloudKid
Released under the MIT License.