|
@ -211,15 +211,20 @@ module.exports = () => { |
|
|
//
|
|
|
//
|
|
|
// ipcMain.handle('removeApp', removeApp);
|
|
|
// ipcMain.handle('removeApp', removeApp);
|
|
|
|
|
|
|
|
|
/* 示例 |
|
|
|
|
|
|
|
|
/* 示例:在网页中调用ipcRenderer模块 |
|
|
ipcRenderer.send('spawn', { |
|
|
ipcRenderer.send('spawn', { |
|
|
command: '微信.exe', |
|
|
command: '微信.exe', |
|
|
args: null || ['--disable-cache'], |
|
|
args: null || ['--disable-cache'], |
|
|
key: + new Date // 唯一key,用来做关闭识别
|
|
|
|
|
|
|
|
|
key: + new Date // 唯一key,用来做关闭识别,
|
|
|
|
|
|
options: { |
|
|
|
|
|
onSuccess: data => {}, // 正常执行回调
|
|
|
|
|
|
onError: err => {}, // 错误执行回调
|
|
|
|
|
|
onClose: code => {}, // 关闭回调
|
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
*/ |
|
|
*/ |
|
|
ipcMain.on('spawn', (event, arg) => { |
|
|
ipcMain.on('spawn', (event, arg) => { |
|
|
const pid = childProcess.start(arg.command, arg.args) |
|
|
|
|
|
|
|
|
const pid = childProcess.start(arg.command, arg.args, arg.options) |
|
|
event.sender.send('spawn-success', { |
|
|
event.sender.send('spawn-success', { |
|
|
key: arg.key, |
|
|
key: arg.key, |
|
|
pid |
|
|
pid |
|
|