当egg业务中需要调用electron相关api时,可在app/service模块,调用this.ipcCall()方法。如:
# 打开文件夹// app/service/example.js# egg服务调用electron功能async openLocalDir(dir) {await this.ipcCall('example.openDir', dir);return true;}// electron/apis/example.jsexports.openDir = function (dir = '') {if (!dir) {return false;}dir = getElectronPath(dir);shell.openPath(dir);return true;}
