Skip to content

ERROR Uncaught ReferenceError: webContents is not defined #134

Open
@mike2003

Description

@mike2003

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions