mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
Merge pull request #2875 from smolgumball/fix-electron-crash-during-reload
fix: electron `windowTracker` crash when reloading and killing scripts
This commit is contained in:
commit
fb4812b530
@ -29,6 +29,11 @@ const windowTracker = (windowName) => {
|
||||
};
|
||||
|
||||
const saveState = debounce(() => {
|
||||
if (!window || window.isDestroyed()) {
|
||||
log.silly(`Saving window state failed because window is not available`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!windowState.isMaximized) {
|
||||
windowState = window.getBounds();
|
||||
}
|
||||
@ -41,7 +46,7 @@ const windowTracker = (windowName) => {
|
||||
|
||||
const track = (win) => {
|
||||
window = win;
|
||||
['resize', 'move', 'close'].forEach((event) => {
|
||||
["resize", "move", "close"].forEach((event) => {
|
||||
win.on(event, saveState);
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user