I am trying to run ng-Web-Worker in one the file.Actually because large functionality this worker needs some dependencies of other factory/Service but i found that this worker is not functioning properly because of these dependencies. I have tried to import scripts also still i am facing the issue. i have pasted below the piece of code. Could you please help me out from this issue.
Code :
// worker.js
function syncServerRecords () {
console.log(" sync Server Records start");
importScripts("checkService.js");
checkService.testFunction().then(function (result) {
console.log("function success");
});
};
var myWorker = Webworker.create(syncServerRecords);
myWorker.run().then(function(result) {
console.log("===Done After run===");
}, null, function(progress) {
// promise has a notification
// console.log("Progress ==> "+progress);
});
// checkService.js
(function () {
'use strict';
angular.module('sample').factory('checkService', [checkService]);
function checkService() {
var serArr = {};
serArr.testFunction= function () {
console.log("===checkService===");
return;
};
return serArr;
}
})();
Hi nitinyeole, have you find the way to slove injected service issue? I also meet the same problem with anguar injected dependcy, I can using the $filter function I wrote. It said $filter not define.
Use Plugin : ng-webworker
I am trying to run ng-Web-Worker in one the file.Actually because large functionality this worker needs some dependencies of other factory/Service but i found that this worker is not functioning properly because of these dependencies. I have tried to import scripts also still i am facing the issue. i have pasted below the piece of code. Could you please help me out from this issue.
Code : // worker.js function syncServerRecords () { console.log(" sync Server Records start"); importScripts("checkService.js"); checkService.testFunction().then(function (result) { console.log("function success");
}); };
// checkService.js (function () { 'use strict'; angular.module('sample').factory('checkService', [checkService]); function checkService() { var serArr = {}; serArr.testFunction= function () { console.log("===checkService==="); return; }; return serArr; } })();