ng-webworker
ng-webworker copied to clipboard
Function in Webworker called only once
Hi, can you help me?
I created simple worker in controller:
var testWorker = Webworker.create(function() {return 5});
var count = 0;
$scope.runWorker() {
testWorker.run().then(function() {
count++;
console.log(count);
})
}
and in template I launch runWorker function:
<span class="button" ng-click="runWorker()">click me</span>
But runWorker function run only once. What am I doing wrong? To fix this problem, now I am creating worker ("Webworker.create(function() {return 5})") every time when I click on the button.
If someone bump into this: a Webworker
will always terminate if useHelper
is not set.