Skip to content

Commit 6ce304f

Browse files
committed
chore: upgrade Electron
1 parent 5eb378e commit 6ce304f

File tree

4 files changed

+831
-188
lines changed

4 files changed

+831
-188
lines changed

main.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const electron = require("electron");
44
const app = electron.app; // Module to control application life.
55
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.
6+
require("@electron/remote/main").initialize(); // Enable @electron/remote support
67

78
// Keep a global reference of the window object, if you don't, the window will
89
// be closed automatically when the JavaScript object is garbage collected.
@@ -21,10 +22,20 @@ app.on("window-all-closed", function() {
2122
// initialization and is ready to create browser windows.
2223
app.on("ready", function() {
2324
// Create the browser window.
24-
mainWindow = new BrowserWindow({ width: 800, height: 600, title: "Joust" });
25+
mainWindow = new BrowserWindow({
26+
width: 800,
27+
height: 600,
28+
title: "Joust",
29+
webPreferences: {
30+
nodeIntegration: true,
31+
contextIsolation: false,
32+
},
33+
});
34+
35+
require("@electron/remote/main").enable(mainWindow.webContents);
2536

2637
// and load the electron.html of the app.
27-
mainWindow.loadURL("file://" + __dirname + "/dist/debug.html");
38+
mainWindow.loadURL("file://" + __dirname + "/dist/debug.html?");
2839

2940
// Open the DevTools.
3041
mainWindow.webContents.openDevTools();

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"format:prettier": "prettier --write \"*.{js,json}\" \"ts/**/*.{ts,tsx,js}\""
2929
},
3030
"dependencies": {
31+
"@electron/remote": "^2",
3132
"@types/cookiejs": "^1.0.30",
3233
"@types/jasmine": "^2.5.46",
3334
"@types/lodash": "^4.14.58",
@@ -43,7 +44,7 @@
4344
"bowser": "^1.6.0",
4445
"cookie_js": "^1.2.2",
4546
"cssnano": "^3.10.0",
46-
"electron": "^1.7.11",
47+
"electron": "^14",
4748
"filereader-stream": "^1.0.0",
4849
"git-describe": "^4.0.1",
4950
"gulp": "^3.9.1",

ts/debug.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import * as React from "react";
22
import * as ReactDOM from "react-dom";
3-
import * as electron from "electron";
3+
import { process } from "@electron/remote";
44
import DebugApplication from "./components/DebugApplication";
55
export * from "./run";
66

7-
const { process } = electron.remote;
8-
97
export function renderApplication(target: string) {
108
// electron argv follows bash/c++ ones [electronpath, arg1 ("." in our case), <optionalreplayname>]
119
const replayName = process.argv.length > 2 ? process.argv[2] : null;

0 commit comments

Comments
 (0)