Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR Uncaught ReferenceError: webContents is not defined #134

Open
mike2003 opened this issue Jun 23, 2022 · 1 comment
Open

ERROR Uncaught ReferenceError: webContents is not defined #134

mike2003 opened this issue Jun 23, 2022 · 1 comment

Comments

@mike2003
Copy link

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
Copy link

Tibus commented Jul 10, 2022

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants