Commit 23f7d3279e5f48523b11e7671da773fc9c131c48

Authored by Amrita Vishnoi
1 parent 4edcf83e

trying to integrate threading in angularJS to speed up things by using web worker process

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -1340,30 +1340,32 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1340 1340 //4.
1341 1341  
1342 1342 $scope.machedTermNoLocation = [];
1343   - for (var i = 0; i < TermList.length; i++) {
  1343 + //for (var i = 0; i < TermList.length; i++) {
1344 1344  
1345   - var termNumber = parseInt(TermList[i]._TermNumber);
  1345 + // var termNumber = parseInt(TermList[i]._TermNumber);
1346 1346  
1347   - //Match Term No List in each bodyRegion
1348   - $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
1349   - }
  1347 + // //Match Term No List in each bodyRegion
  1348 + // $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
  1349 + //}
1350 1350  
1351 1351  
1352 1352  
1353   - //var worker = new Worker('term-number-wp.js');
  1353 + var worker = new Worker('term-number-wp.js');
  1354 +
  1355 +
1354 1356  
1355   - //worker.onmessage = function (e) {
1356   - // var msg = e.data.msg;
1357   - //};
1358   - //worker.onerror = function (e) {
1359   - // alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
1360   - //};
  1357 + //start the worker
  1358 + worker.postMessage({
  1359 + 'cmd': 'abc',
  1360 + 'value': 'send msg from DA controller'
  1361 + });
1361 1362  
1362   - ////start the worker
1363   - //worker.postMessage({
1364   - // 'cmd': 'abc',
1365   - // 'value': 'send msg from DA controller'
1366   - //});
  1363 + worker.onmessage = function (e) {
  1364 + var msg = e.data.msg;
  1365 + };
  1366 + worker.onerror = function (e) {
  1367 + alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  1368 + };
1367 1369 }
1368 1370 }
1369 1371 else {
... ... @@ -1381,24 +1383,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1381 1383  
1382 1384 var termNumber = parseInt(TermList[i]._TermNumber);
1383 1385  
1384   - // var worker = new Worker('term-number-wp.js');
  1386 + var worker = new Worker('term-number-wp.js');
1385 1387  
1386 1388  
1387 1389  
1388   - ////start the worker
1389   - //worker.postMessage({
1390   - // 'cmd': 'abc',
1391   - // 'value': 'send msg from DA controller'
1392   - //});
1393   -
1394   - //worker.onmessage = function (e) {
1395   - // var msg = e.data.msg;
1396   - //};
1397   - //worker.onerror = function (e) {
1398   - // alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
1399   - //};
  1390 + //start the worker
  1391 + worker.postMessage({
  1392 + 'cmd': 'abc',
  1393 + 'value': 'send msg from DA controller'
  1394 + });
  1395 +
  1396 + worker.onmessage = function (e) {
  1397 + var msg = e.data.msg;
  1398 + };
  1399 + worker.onerror = function (e) {
  1400 + alert('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  1401 + };
1400 1402 //Match Term No List in each bodyRegion
1401   - $scope.getLocationsForMatchedTermsInWholeBody(termNumber);
  1403 + //$scope.getLocationsForMatchedTermsInWholeBody(termNumber);
1402 1404 }
1403 1405  
1404 1406 debugger;
... ...