Electron版本V21.4.4。
大多数方法是采用electron的remote模块,但是remote模块早在electron14版本就已经废除。只能另辟蹊径:
1.采用单独的@electron/remote模块进行替代。大致流程是在主进程初始化,渲染进程进行使用。但是官方介绍已经不推荐。原话如下(详见:GitHub - electron/remote: Bridge JavaScript objects from the main process to the renderer process in Electron.):
Warning! This module has many subtle pitfalls. There is almost always a better way to accomplish your task than using this module. For example, ipcRenderer.invoke