worker共用同一线程方式实现
This commit is contained in:
@@ -470,6 +470,7 @@ export class MainComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* 创建线程并执行
|
* 创建线程并执行
|
||||||
*/
|
*/
|
||||||
|
public promise:Worker = new Worker('/adminweb/assets/web-worker-handle.js');
|
||||||
creatWorkers() {
|
creatWorkers() {
|
||||||
let dynamicData = {
|
let dynamicData = {
|
||||||
raw_data: this.raw_data,
|
raw_data: this.raw_data,
|
||||||
@@ -480,20 +481,19 @@ export class MainComponent implements OnInit {
|
|||||||
flightStatus: this.flightStatus,
|
flightStatus: this.flightStatus,
|
||||||
flightTypes: this.flightTypes
|
flightTypes: this.flightTypes
|
||||||
}
|
}
|
||||||
// const promise = new Worker('/assets/web-worker-handle.js');
|
this.promise.postMessage(dynamicData);
|
||||||
// promise.postMessage(dynamicData);
|
this.promise.onmessage = function (e) {
|
||||||
// promise.onmessage = function (e) {
|
console.log('=====');
|
||||||
// console.log('=====');
|
this.combined_data = e.data;
|
||||||
// this.combined_data = e.data;
|
|
||||||
// this.selectChange('dynamic');
|
|
||||||
// // promise.terminate();
|
|
||||||
// }.bind(this);
|
|
||||||
const promise = this.webWorkerService.run(webWorkerHandle, dynamicData);
|
|
||||||
promise.then(function (response) {
|
|
||||||
this.combined_data = response;
|
|
||||||
this.selectChange('dynamic');
|
this.selectChange('dynamic');
|
||||||
this.webWorkerService.terminate(promise);
|
// this.promise.terminate();
|
||||||
}.bind(this));
|
}.bind(this);
|
||||||
|
// const promise = this.webWorkerService.run(webWorkerHandle, dynamicData);
|
||||||
|
// promise.then(function (response) {
|
||||||
|
// this.combined_data = response;
|
||||||
|
// this.selectChange('dynamic');
|
||||||
|
// this.webWorkerService.terminate(promise);
|
||||||
|
// }.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -646,7 +646,7 @@ export class MainComponent implements OnInit {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (item['preFlight'][key] === filterItems[key]) {
|
if (item['preFlight'][key] == filterItems[key]) {
|
||||||
is_satis = true;
|
is_satis = true;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
@@ -690,7 +690,7 @@ export class MainComponent implements OnInit {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (item['reaFlight'][key] === filterItems[key]) {
|
if (item['reaFlight'][key] == filterItems[key]) {
|
||||||
is_satis = true;
|
is_satis = true;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
@@ -735,7 +735,7 @@ export class MainComponent implements OnInit {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (item['preFlight'][key] === filterItems[key]) {
|
if (item['preFlight'][key] == filterItems[key]) {
|
||||||
pre_satis = true;
|
pre_satis = true;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
@@ -776,7 +776,7 @@ export class MainComponent implements OnInit {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (item['reaFlight'][key] === filterItems[key]) {
|
if (item['reaFlight'][key] == filterItems[key]) {
|
||||||
rea_satis = true;
|
rea_satis = true;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user