ipcMain undefined...
jogibear9988 opened this issue · 6 comments
jogibear9988 commented
jogibear9988 commented
@ckerr why? the initialize could be called. the require does work
ckerr commented
Hmm, maybe I scanned this too quickly then. Sorry about that.
jogibear9988 commented
If I dont call the initalize, I get this error:
Uncaught (in promise) Error: @electron/remote is disabled for this WebContents. Call require("@electron/remote/main").enable(webContents) to enable it.
at IpcMainImpl.<anonymous> (D:\mcc-client-app\resources\app\node_modules\@electron\remote\dist\src\main\server.js:317:61)
at IpcMainImpl.emit (node:events:394:28)
at Object.<anonymous> (node:electron/js2c/browser_init:165:10589)
at Object.emit (node:events:394:28)
but in my index.js I do this:
win = new BrowserWindow({
width: 1400, height: 1024, frame: false, webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
devTools: true
}
})
jogibear9988 commented
I don't know how to do this:
require("@electron/remote/main").enable(webContents)
cause I have no object
webContents
jogibear9988 commented
fixed it,
need to add
require('@electron/remote/main').enable(win.webContents);
in my main.js