feat: store all settings before quit

This commit is contained in:
lin onetwo 2024-01-06 21:47:16 +08:00
parent 5c5e7f5f2f
commit 7dce635e6f
2 changed files with 2 additions and 1 deletions

View file

@ -180,6 +180,7 @@ app.on(
await Promise.all([
wikiService.stopAllWiki(),
windowService.clearWindowsReference(),
databaseService.immediatelyStoreSettingsToFile(),
]);
destroyLogger();
app.exit(0);

View file

@ -22,7 +22,6 @@ const log = (message: string): void => {
};
async function refresh(): Promise<void> {
// get path from src/constants/paths.ts
log(`constantsFetched: ${String(constantsFetched)}`);
if (!constantsFetched) {
await Promise.all([
context.get('CHROME_ERROR_PATH').then((pathName) => {
@ -88,6 +87,7 @@ async function refresh(): Promise<void> {
await windowService.loadURL(windowName, MAIN_WINDOW_WEBPACK_ENTRY);
}
} else if (window.location.href === CHROME_ERROR_PATH) {
log(`window.location.href === CHROME_ERROR_PATH`);
await windowService.loadURL(windowName, MAIN_WINDOW_WEBPACK_ENTRY);
} else {
setTimeout(() => void refresh(), CHECK_LOADED_INTERVAL);