Clear Cache everytime start
This commit is contained in:
34
main.js
34
main.js
@@ -64,11 +64,40 @@ const createWindow = () => {
|
|||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
//win.loadURL('https://nexus.manage.backone.cloud/')
|
//win.loadURL('https://nexus.manage.backone.cloud/')
|
||||||
const ses = win.webContents.session
|
//const ses = win.webContents.session
|
||||||
ses.clearCache()
|
//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(() => {
|
app.whenReady().then(() => {
|
||||||
createWindow()
|
createWindow()
|
||||||
|
|
||||||
@@ -82,3 +111,4 @@ app.whenReady().then(() => {
|
|||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
if (process.platform !== 'darwin') app.quit()
|
if (process.platform !== 'darwin') app.quit()
|
||||||
})
|
})
|
||||||
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user