Skip to content

Commit

Permalink
chore: upgrade Electron
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Mar 26, 2024
1 parent 5eb378e commit 6ce304f
Show file tree
Hide file tree
Showing 4 changed files with 831 additions and 188 deletions.
15 changes: 13 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const electron = require("electron");
const app = electron.app; // Module to control application life.
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.
require("@electron/remote/main").initialize(); // Enable @electron/remote support

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
Expand All @@ -21,10 +22,20 @@ app.on("window-all-closed", function() {
// initialization and is ready to create browser windows.
app.on("ready", function() {
// Create the browser window.
mainWindow = new BrowserWindow({ width: 800, height: 600, title: "Joust" });
mainWindow = new BrowserWindow({
width: 800,
height: 600,
title: "Joust",
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
});

require("@electron/remote/main").enable(mainWindow.webContents);

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

// Open the DevTools.
mainWindow.webContents.openDevTools();
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"format:prettier": "prettier --write \"*.{js,json}\" \"ts/**/*.{ts,tsx,js}\""
},
"dependencies": {
"@electron/remote": "^2",
"@types/cookiejs": "^1.0.30",
"@types/jasmine": "^2.5.46",
"@types/lodash": "^4.14.58",
Expand All @@ -43,7 +44,7 @@
"bowser": "^1.6.0",
"cookie_js": "^1.2.2",
"cssnano": "^3.10.0",
"electron": "^1.7.11",
"electron": "^14",
"filereader-stream": "^1.0.0",
"git-describe": "^4.0.1",
"gulp": "^3.9.1",
Expand Down
4 changes: 1 addition & 3 deletions ts/debug.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as electron from "electron";
import { process } from "@electron/remote";
import DebugApplication from "./components/DebugApplication";
export * from "./run";

const { process } = electron.remote;

export function renderApplication(target: string) {
// electron argv follows bash/c++ ones [electronpath, arg1 ("." in our case), <optionalreplayname>]
const replayName = process.argv.length > 2 ? process.argv[2] : null;
Expand Down
Loading

0 comments on commit 6ce304f

Please sign in to comment.