here code. getting error.please me on issue.
in controller
if(typeof(worker) !== "undefined") { if(typeof(worker) == "undefined") { var worker = new worker("assets/scripts/directives/custommultifilter.js"); worker.postmessage({ "getobject":scope.payloadrowcollection}); worker.onmessage = function(event) { console.log(event); } } }
in web worker (custommultifilter.js)
self.addeventlistener("message", function(e) { $scope.arr = [1,2,3]; postmessage($scope.arr); }, false);
it not possible share variables between web workers , "main" script. run concurrency issues if was.
but can communicate via events:
// in worker self.postmessage('somedata); // in angular worker.addeventlistener('message', function(e) { console.log('worker said: ', e.data); }, false);
here tutorial web workers. http://www.html5rocks.com/en/tutorials/workers/basics/
Comments
Post a Comment