From 9a281725652ebf96120e71d0426ec938d6deb613 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Tue, 30 Apr 2024 18:37:50 +0530 Subject: [PATCH] iife wrapper --- desktop/.eslintrc.js | 2 +- desktop/src/main.ts | 52 +++++++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/desktop/.eslintrc.js b/desktop/.eslintrc.js index daf2c2838..8c1867fc7 100644 --- a/desktop/.eslintrc.js +++ b/desktop/.eslintrc.js @@ -28,7 +28,7 @@ module.exports = { /* Temporary (RIP) */ "@typescript-eslint/no-unsafe-return": "off", "@typescript-eslint/no-confusing-void-expression": "off", - "@typescript-eslint/no-misused-promises": "off", + // "@typescript-eslint/no-misused-promises": "off", // "@typescript-eslint/no-floating-promises": "off", }, }; diff --git a/desktop/src/main.ts b/desktop/src/main.ts index f5ad89158..c849c755f 100644 --- a/desktop/src/main.ts +++ b/desktop/src/main.ts @@ -202,8 +202,8 @@ const createMainWindow = () => { app.dock.hide(); }); - window.on("show", async () => { - if (process.platform == "darwin") await app.dock.show(); + window.on("show", () => { + if (process.platform == "darwin") void app.dock.show(); }); // Let ipcRenderer know when mainWindow is in the foreground so that it can @@ -365,33 +365,35 @@ const main = () => { // Emitted once, when Electron has finished initializing. // // Note that some Electron APIs can only be used after this event occurs. - app.on("ready", async () => { - // Create window and prepare for the renderer. - mainWindow = createMainWindow(); - attachIPCHandlers(); - attachFSWatchIPCHandlers(createWatcher(mainWindow)); - registerStreamProtocol(); + app.on("ready", () => { + void (async () => { + // Create window and prepare for the renderer. + mainWindow = createMainWindow(); + attachIPCHandlers(); + attachFSWatchIPCHandlers(createWatcher(mainWindow)); + registerStreamProtocol(); - // Configure the renderer's environment. - setDownloadPath(mainWindow.webContents); - allowExternalLinks(mainWindow.webContents); + // Configure the renderer's environment. + setDownloadPath(mainWindow.webContents); + allowExternalLinks(mainWindow.webContents); - // Start loading the renderer. - void mainWindow.loadURL(rendererURL); + // Start loading the renderer. + void mainWindow.loadURL(rendererURL); - // Continue on with the rest of the startup sequence. - Menu.setApplicationMenu(await createApplicationMenu(mainWindow)); - setupTrayItem(mainWindow); - if (!isDev) setupAutoUpdater(mainWindow); + // Continue on with the rest of the startup sequence. + Menu.setApplicationMenu(await createApplicationMenu(mainWindow)); + setupTrayItem(mainWindow); + if (!isDev) setupAutoUpdater(mainWindow); - try { - await deleteLegacyDiskCacheDirIfExists(); - await deleteLegacyKeysStoreIfExists(); - } catch (e) { - // Log but otherwise ignore errors during non-critical startup - // actions. - log.error("Ignoring startup error", e); - } + try { + await deleteLegacyDiskCacheDirIfExists(); + await deleteLegacyKeysStoreIfExists(); + } catch (e) { + // Log but otherwise ignore errors during non-critical startup + // actions. + log.error("Ignoring startup error", e); + } + })(); }); // This is a macOS only event. Show our window when the user activates the