Clear Cache everytime start

This commit is contained in:
2025-12-22 17:17:53 +07:00
parent 3ad20ad64c
commit d3d17da2c8

34
main.js
View File

@@ -64,11 +64,40 @@ const createWindow = () => {
});
*/
//win.loadURL('https://nexus.manage.backone.cloud/')
const ses = win.webContents.session
ses.clearCache()
//const ses = win.webContents.session
//ses.clearCache()
}
app.on('ready', async () => {
// Clear the default session's cache before the window is ready to load content
try {
await session.defaultSession.clearCache();
console.log('Cache cleared successfully on app start.');
} catch (err) {
console.error('Failed to clear cache:', err);
}
createWindow();
// Quit app when all windows are closed, except on macOS (common pattern)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
// Recreate a window in the app when the dock icon is clicked (macOS)
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
/*
app.whenReady().then(() => {
createWindow()
@@ -82,3 +111,4 @@ app.whenReady().then(() => {
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
*/