mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 04:05:46 +01:00
Attempt to fix processes that stay up after closing app
This commit is contained in:
parent
3436873373
commit
dc21a5b87b
@ -9,12 +9,22 @@ if (greenworks.init()) {
|
||||
|
||||
const debug = false;
|
||||
|
||||
let win;
|
||||
let intervalID;
|
||||
|
||||
function createWindow(killall) {
|
||||
const win = new BrowserWindow({
|
||||
win = new BrowserWindow({
|
||||
show: false,
|
||||
backgroundThrottling: false,
|
||||
});
|
||||
|
||||
win.on('closed', function() {
|
||||
clearInterval(intervalID);
|
||||
win = null;
|
||||
app.quit();
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
win.removeMenu();
|
||||
win.maximize();
|
||||
noScripts = killall ? { query: { noScripts: killall } } : {};
|
||||
@ -37,7 +47,7 @@ function createWindow(killall) {
|
||||
// This is backward but the game fills in an array called `document.achievements` and we retrieve it from
|
||||
// here. Hey if it works it works.
|
||||
const achievements = greenworks.getAchievementNames();
|
||||
const intervalID = setInterval(async () => {
|
||||
intervalID = setInterval(async () => {
|
||||
const achs = await win.webContents.executeJavaScript("document.achievements");
|
||||
console.log(achs);
|
||||
for (const ach of achs) {
|
||||
@ -111,6 +121,17 @@ function createWindow(killall) {
|
||||
);
|
||||
}
|
||||
|
||||
app.on('window-all-closed', function () {
|
||||
// On OS X it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform !== 'darwin') {
|
||||
clearInterval(intervalID);
|
||||
win = null;
|
||||
app.quit()
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow(false);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user