Enabling usage or @electron/remote in main window

This commit is contained in:
Maurício Szabo 2023-04-11 18:08:30 -03:00
parent 846c91ecc0
commit c8ed2ee703
2 changed files with 5 additions and 3 deletions

View File

@ -86,6 +86,7 @@ module.exports = class AtomWindow extends EventEmitter {
const BrowserWindowConstructor =
settings.browserWindowConstructor || BrowserWindow;
this.browserWindow = new BrowserWindowConstructor(options);
electronRemote.enable(this.browserWindow.webContents)
Object.defineProperty(this.browserWindow, 'loadSettingsJSON', {
get: () =>

View File

@ -4,6 +4,7 @@
const startWindowTime = Date.now();
const electron = require('electron');
const remote = require('@electron/remote');
const path = require('path');
const Module = require('module');
const getWindowLoadSettings = require('../src/get-window-load-settings');
@ -12,7 +13,7 @@
const entryPointDirPath = __dirname;
let blobStore = null;
const startupMarkers = electron.remote.getCurrentWindow().startupMarkers;
const startupMarkers = remote.getCurrentWindow().startupMarkers;
if (startupMarkers) {
StartupTime.importData(startupMarkers);
@ -78,7 +79,7 @@
}
function handleSetupError(error) {
const currentWindow = electron.remote.getCurrentWindow();
const currentWindow = remote.getCurrentWindow();
currentWindow.setSize(800, 600);
currentWindow.center();
currentWindow.show();
@ -139,7 +140,7 @@
});
}
const webContents = electron.remote.getCurrentWindow().webContents;
const webContents = remote.getCurrentWindow().webContents;
if (webContents.devToolsWebContents) {
profile();
} else {