mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-28 07:58:16 +08:00
Opt: Use callback instead of timeout when closing window
This commit is contained in:
@@ -102,8 +102,9 @@ const createWindow = async () => {
|
|||||||
mainWindow?.isMaximized() ? mainWindow?.restore() : mainWindow?.maximize();
|
mainWindow?.isMaximized() ? mainWindow?.restore() : mainWindow?.maximize();
|
||||||
});
|
});
|
||||||
ipcMain.on('window-close', function () {
|
ipcMain.on('window-close', function () {
|
||||||
alas.kill();
|
alas.kill(function () {
|
||||||
setTimeout(() => mainWindow?.close(), 500); // Wait taskkill to finish
|
mainWindow?.close();
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tray
|
// Tray
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ export class PyShell extends PythonShell {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
kill(): this {
|
kill(callback: (...args: any[]) => void): this {
|
||||||
treeKill(this.childProcess.pid, 'SIGTERM');
|
treeKill(this.childProcess.pid, 'SIGTERM', callback);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user