2022-03-16 17:54:45 +00:00
|
|
|
const { app, BrowserWindow, ipcMain } = require('electron');
|
2023-06-15 14:42:27 +00:00
|
|
|
const path = require('node:path');
|
2022-03-16 17:54:45 +00:00
|
|
|
|
|
|
|
app.whenReady().then(() => {
|
|
|
|
let reloadCount = 0;
|
|
|
|
const win = new BrowserWindow({
|
|
|
|
show: false,
|
|
|
|
webPreferences: {
|
|
|
|
nodeIntegration: true,
|
|
|
|
contextIsolation: false
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
win.loadFile('index.html');
|
|
|
|
|
|
|
|
win.webContents.on('render-process-gone', () => {
|
|
|
|
process.exit(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
win.webContents.on('did-finish-load', () => {
|
|
|
|
if (reloadCount > 2) {
|
|
|
|
setImmediate(() => app.quit());
|
|
|
|
} else {
|
|
|
|
reloadCount += 1;
|
|
|
|
win.webContents.send('reload', path.join(__dirname, '..', '..', 'cat.pdf'));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|