Electron渲染进程调用主进程
程序员文章站
2022-06-04 19:36:09
...
Electron渲染进程调用主进程
引用
-
const BrowerWindow = require(“electron”).remote.BrowserWindow;
-
const { remote } = require(“electron”);
const BrowerWindow = remote.BrowserWindow;
应用
var contentDom = document.querySelector('#index');
const BrowerWindow = require("electron").remote.BrowserWindow;
contentDom.onclick = () =>{
let win = new BrowerWindow({
width: 300,
height: 200,
frame: false,
transparent: true
})
win.loadURL(path.join('file:',__dirname,'news.html'));
win.on('close',()=>{win = null});
}
在主进程写入:
webPreferences:{
enableRemoteModule: true
}
上一篇: electron主进程与渲染进程通信
下一篇: electron 主进程调试