Refactor Steam callback cleanup on app exit
Simplified the cleanup logic for Steam callback pump by removing unnecessary try-catch and optional chaining. The cleanup is now directly registered after requiring Electron modules.
This commit is contained in:
@@ -127,9 +127,10 @@ function initializeSteamworks() {
|
||||
// This is critical for Steam Input to recognize native controller support
|
||||
initializeSteamworks();
|
||||
|
||||
const { app, BrowserWindow, ipcMain, session, screen, shell, dialog, Menu, clipboard, webContents } = require('electron');
|
||||
|
||||
// Cleanup Steam callback pump on exit
|
||||
try {
|
||||
app?.once?.('before-quit', () => {
|
||||
app.once('before-quit', () => {
|
||||
if (steamCallbacksInterval) {
|
||||
clearInterval(steamCallbacksInterval);
|
||||
steamCallbacksInterval = null;
|
||||
@@ -138,9 +139,6 @@ try {
|
||||
steamInput?.shutdown?.();
|
||||
} catch {}
|
||||
});
|
||||
} catch {}
|
||||
|
||||
const { app, BrowserWindow, ipcMain, session, screen, shell, dialog, Menu, clipboard, webContents } = require('electron');
|
||||
const { autoUpdater } = require('electron-updater');
|
||||
const { pathToFileURL } = require('url');
|
||||
const fs = require('fs');
|
||||
|
||||
Reference in New Issue
Block a user