electron经验手记(1)#
关于渲染进程引用nodejs模块
const createWindow = () => {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true, //开启渲染进程中使用nodejs
contextIsolation: false, //开启渲染进程中使用nodejs In Electron 12, the default will bechanged to `true
}
});
关于引用remote模块
主进程:
const remote = require('@electron/remote/main');
remote.initialize();
……
remote.enable(mainWindow.webContents);
渲染进程:var remote = require('@electron/remote')
安装使用eslint
cnpm install -g eslint