mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-17 13:13:49 +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;
|
const debug = false;
|
||||||
|
|
||||||
|
let win;
|
||||||
|
let intervalID;
|
||||||
|
|
||||||
function createWindow(killall) {
|
function createWindow(killall) {
|
||||||
const win = new BrowserWindow({
|
win = new BrowserWindow({
|
||||||
show: false,
|
show: false,
|
||||||
backgroundThrottling: false,
|
backgroundThrottling: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
win.on('closed', function() {
|
||||||
|
clearInterval(intervalID);
|
||||||
|
win = null;
|
||||||
|
app.quit();
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
|
||||||
win.removeMenu();
|
win.removeMenu();
|
||||||
win.maximize();
|
win.maximize();
|
||||||
noScripts = killall ? { query: { noScripts: killall } } : {};
|
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
|
// 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.
|
// here. Hey if it works it works.
|
||||||
const achievements = greenworks.getAchievementNames();
|
const achievements = greenworks.getAchievementNames();
|
||||||
const intervalID = setInterval(async () => {
|
intervalID = setInterval(async () => {
|
||||||
const achs = await win.webContents.executeJavaScript("document.achievements");
|
const achs = await win.webContents.executeJavaScript("document.achievements");
|
||||||
console.log(achs);
|
console.log(achs);
|
||||||
for (const ach of 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(() => {
|
app.whenReady().then(() => {
|
||||||
createWindow(false);
|
createWindow(false);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user