reload n kill on steam

This commit is contained in:
Olivier Gagnon 2021-12-12 12:48:42 -05:00
parent 5f696aba72
commit c845fb4203

@ -1,4 +1,4 @@
const { app, BrowserWindow, Menu, globalShortcut, shell } = require("electron"); const { app, BrowserWindow, Menu, shell } = require("electron");
const greenworks = require("./greenworks"); const greenworks = require("./greenworks");
if (greenworks.init()) { if (greenworks.init()) {
@ -22,12 +22,6 @@ function createWindow() {
win.loadFile("index.html"); win.loadFile("index.html");
win.show(); win.show();
if (debug) win.webContents.openDevTools(); if (debug) win.webContents.openDevTools();
globalShortcut.register("f5", function () {
win.loadFile("index.html");
});
globalShortcut.register("f8", function () {
win.loadFile("index.html", { query: { noScripts: "true" } });
});
win.webContents.on("new-window", function (e, url) { win.webContents.on("new-window", function (e, url) {
// make sure local urls stay in electron perimeter // make sure local urls stay in electron perimeter
@ -55,6 +49,25 @@ function createWindow() {
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }, { label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" },
], ],
}, },
{
label: "reloads",
submenu: [
{
label: "reload",
accelerator: "f5",
click: () => {
win.loadFile("index.html");
},
},
{
label: "reload & kill all scripts",
click: () => {
win.webContents.forcefullyCrashRenderer();
setTimeout(() => win.loadFile("index.html", { query: { noScripts: "true" } }), 5000);
},
},
],
},
]), ]),
); );