electron/remote

ERROR Uncaught ReferenceError: webContents is not defined

mike2003 opened this issue · 1 comments

I wanted to repeat the lesson https://www.youtube.com/watch?v=2RxHQoiDctI
But there is used remote
I already know that this is a deprecated method, but I want to finish.

I need to close the second window. It closes itself.
var window = remote.getCurrentWindow();
window.close();

I've included @electron/remote in main, but I can't get remote here.

main.js
require("@electron/remote/main").initialize();
require("@electron/remote/main").enable(win.webContents);

But in the second window it does not work and the browser swears. It tells me to write this code, but that doesn't help either.

const remote = require("@electron/remote")
require("@electron/remote/main").enable(webContents)

webContents is not defined

Tibus commented

Same here