Skip to content

Commit 6de0ecb

Browse files
committed
feat: clarify its the main window; debug messages
1 parent 663d1ff commit 6de0ecb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

electron/main/app.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if (appEnvIsProd) {
4949

5050
let ipcController: IpcController;
5151

52-
const createWindow = async (): Promise<void> => {
52+
const createMainWindow = async (): Promise<void> => {
5353
if (appEnvIsDev) {
5454
// If running in development, serve the renderer from localhost.
5555
// This must be done once the app is ready.
@@ -86,7 +86,7 @@ const createWindow = async (): Promise<void> => {
8686

8787
// Once the window has finished loading, show it.
8888
mainWindow.webContents.once('did-finish-load', () => {
89-
logger.info('showing window');
89+
logger.info('showing main window');
9090
mainWindow.show();
9191
});
9292

@@ -101,6 +101,7 @@ const createWindow = async (): Promise<void> => {
101101

102102
ipcController = newIpcController({ dispatch });
103103

104+
logger.info('loading main window', { appUrl });
104105
await mainWindow.loadURL(appUrl);
105106

106107
initializeMenu(mainWindow);
@@ -109,7 +110,7 @@ const createWindow = async (): Promise<void> => {
109110
// Prepare the renderer once the app is ready
110111
app.on('ready', () => {
111112
runInBackground(async () => {
112-
await createWindow();
113+
await createMainWindow();
113114
});
114115
});
115116

@@ -155,6 +156,7 @@ app.on('web-contents-created', (_, contents) => {
155156
});
156157

157158
app.on('window-all-closed', (): void => {
159+
logger.debug('windows all closed, quitting app');
158160
app.quit();
159161
});
160162

@@ -177,6 +179,7 @@ app.on('before-quit', (event: Event): void => {
177179
event.preventDefault();
178180
beforeQuitActionStatus = BeforeQuitActionStatus.IN_PROGRESS;
179181
runInBackground(async () => {
182+
logger.debug('performing before-quit operations');
180183
await ipcController?.destroy();
181184
beforeQuitActionStatus = BeforeQuitActionStatus.COMPLETED;
182185
app.quit();
@@ -193,5 +196,6 @@ app.on('before-quit', (event: Event): void => {
193196
});
194197

195198
app.on('quit', (): void => {
199+
logger.debug('quitting app');
196200
logger.info('until next time, brave adventurer');
197201
});

0 commit comments

Comments
 (0)