我是 Electron 的新手,我真的一直在努力让它工作。我遇到了无法解释的行为,所以总结一下:我无法使 Electron 和 html 之间的通信正常工作
“未捕获的 ReferenceError:需要未定义”在网站内,即使我有 nodeIntegration:true
File Tree:
./
index.html
index.js
package-lock.json
package.json
node_modules/
Run Code Online (Sandbox Code Playgroud)
索引.js:
const electron = require("electron");
const Ffmpeg = require("fluent-ffmpeg");
const CmdExec = require('child_process');
const {
app,
BrowserWindow,
ipcMain
} = electron;
function createWindow() {
//If I put the main window ini into here, and then call app.on("ready", createWindow()); app says
//"Cant create window before ready", even though I just moved the funcion from inside ready to here..
}
app.on('ready', () => { …Run Code Online (Sandbox Code Playgroud)