fix: 后置机拿不到信号问题
This commit is contained in:
		
							parent
							
								
									7bd3689593
								
							
						
					
					
						commit
						a52a13e6d9
					
				| @ -12,9 +12,6 @@ class differentialAndSignal { | |||||||
| 
 | 
 | ||||||
|   // 初始化Worker |   // 初始化Worker | ||||||
|   init() { |   init() { | ||||||
|     if (this.workerInstance) { |  | ||||||
|       this.close(); |  | ||||||
|     } |  | ||||||
|     this.workerInstance = new worker.ThreadWorker("entry/ets/workers/DifferentialCorrection.ets"); |     this.workerInstance = new worker.ThreadWorker("entry/ets/workers/DifferentialCorrection.ets"); | ||||||
|     let config: EnvironmentConfigurationType = |     let config: EnvironmentConfigurationType = | ||||||
|       AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration") || { |       AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration") || { | ||||||
| @ -55,20 +52,15 @@ class differentialAndSignal { | |||||||
| 
 | 
 | ||||||
|   // 关闭 |   // 关闭 | ||||||
|   close() { |   close() { | ||||||
|     if (this.workerInstance) { |     this.events = []; | ||||||
|       // 清空所有监听器 |     const config: EnvironmentConfigurationType = AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration") || { | ||||||
|       this.events = []; |  | ||||||
| 
 |  | ||||||
|       // 发送关闭消息 |  | ||||||
|       const config = AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration") || {}; |  | ||||||
|       this.workerInstance.postMessage(JSON.stringify({ |  | ||||||
|         config: config, |  | ||||||
|         close: true |  | ||||||
|       })); |  | ||||||
| 
 |  | ||||||
|       // 关闭线程 |  | ||||||
|       this.workerInstance.terminate(); |  | ||||||
|     } |     } | ||||||
|  |     this.workerInstance.postMessage(JSON.stringify({ | ||||||
|  |       config: config, | ||||||
|  |       close: true | ||||||
|  |     })); | ||||||
|  |     // 关闭线程 | ||||||
|  |     this.workerInstance.terminate() | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // 获取Worker消息 |   // 获取Worker消息 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user