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
|
// This is critical for Steam Input to recognize native controller support
|
||||||
initializeSteamworks();
|
initializeSteamworks();
|
||||||
|
|
||||||
|
const { app, BrowserWindow, ipcMain, session, screen, shell, dialog, Menu, clipboard, webContents } = require('electron');
|
||||||
|
|
||||||
// Cleanup Steam callback pump on exit
|
// Cleanup Steam callback pump on exit
|
||||||
try {
|
app.once('before-quit', () => {
|
||||||
app?.once?.('before-quit', () => {
|
|
||||||
if (steamCallbacksInterval) {
|
if (steamCallbacksInterval) {
|
||||||
clearInterval(steamCallbacksInterval);
|
clearInterval(steamCallbacksInterval);
|
||||||
steamCallbacksInterval = null;
|
steamCallbacksInterval = null;
|
||||||
@@ -137,10 +138,7 @@ try {
|
|||||||
try {
|
try {
|
||||||
steamInput?.shutdown?.();
|
steamInput?.shutdown?.();
|
||||||
} catch {}
|
} catch {}
|
||||||
});
|
});
|
||||||
} catch {}
|
|
||||||
|
|
||||||
const { app, BrowserWindow, ipcMain, session, screen, shell, dialog, Menu, clipboard, webContents } = require('electron');
|
|
||||||
const { autoUpdater } = require('electron-updater');
|
const { autoUpdater } = require('electron-updater');
|
||||||
const { pathToFileURL } = require('url');
|
const { pathToFileURL } = require('url');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|||||||
Reference in New Issue
Block a user