|
@@ -35,16 +35,19 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
|
|
},
|
|
|
onDockerImportResponse: (callback) => ipcRenderer.on('docker-import-response', callback),
|
|
|
runSimulation: async (obstacle_flag, default_start_flag, default_end_flag, start_point, end_point) => {
|
|
|
- // ipcRenderer.send('run-simulation', {obstacle_flag, default_start_flag, default_end_flag, start_point, end_point});
|
|
|
- try {
|
|
|
- const result = ipcRenderer.invoke('run-simulation', {obstacle_flag, default_start_flag, default_end_flag, start_point, end_point});
|
|
|
- return result;
|
|
|
- } catch (error) {
|
|
|
- console.error('执行仿真测试出错:', error);
|
|
|
- throw error;
|
|
|
- }
|
|
|
+ // 异步
|
|
|
+ ipcRenderer.send('run-simulation', {obstacle_flag, default_start_flag, default_end_flag, start_point, end_point});
|
|
|
+
|
|
|
+ // 同步
|
|
|
+ // try {
|
|
|
+ // const result = ipcRenderer.invoke('run-simulation', {obstacle_flag, default_start_flag, default_end_flag, start_point, end_point});
|
|
|
+ // return result;
|
|
|
+ // } catch (error) {
|
|
|
+ // console.error('执行仿真测试出错:', error);
|
|
|
+ // throw error;
|
|
|
+ // }
|
|
|
},
|
|
|
- onRunSimulationResponse: (callback) => ipcRenderer.on('run-simulation-response', callback),
|
|
|
+ onRunSimulationResponse: (callback) => ipcRenderer.once('run-simulation-response', callback),
|
|
|
generateWorld: (rosbag_path) => {
|
|
|
// 发送事件到主进程
|
|
|
ipcRenderer.send('generate-world', {rosbag_path});
|