mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-03 14:27:03 +02:00
Use global references for electron event handlers
I messed up the handlers reference in the last commit so the events were not properly attached. Changed it to use global variables for now.
This commit is contained in:
+7
-6
@@ -6,7 +6,6 @@ const greenworks = require("./greenworks");
|
||||
const api = require("./api-server");
|
||||
const gameWindow = require("./gameWindow");
|
||||
const achievements = require("./achievements");
|
||||
const utils = require("./utils");
|
||||
|
||||
log.catchErrors();
|
||||
log.info(`Started app: ${JSON.stringify(process.argv)}`);
|
||||
@@ -48,7 +47,7 @@ function setStopProcessHandler(app, window, enabled) {
|
||||
if (!canRunJS) {
|
||||
// We're stuck, let's crash the process
|
||||
log.warn('Forcefully crashing the renderer process');
|
||||
gameWindow.webContents.forcefullyCrashRenderer();
|
||||
window.webContents.forcefullyCrashRenderer();
|
||||
}
|
||||
|
||||
log.debug('Destroying the window');
|
||||
@@ -84,10 +83,12 @@ function startWindow(noScript) {
|
||||
gameWindow.createWindow(noScript);
|
||||
}
|
||||
|
||||
utils.initialize(setStopProcessHandler, startWindow);
|
||||
global.app_handlers = {
|
||||
stopProcess: setStopProcessHandler,
|
||||
createWindow: startWindow,
|
||||
}
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
app.whenReady().then(() => {
|
||||
log.info('Application is ready!');
|
||||
utils.initialize(setStopProcessHandler, startWindow);
|
||||
startWindow(process.argv.includes("--no-scripts"))
|
||||
startWindow(process.argv.includes("--no-scripts"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user