-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
24 lines (22 loc) · 818 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const {app, BrowserWindow,ipcMain} = require('electron')
const { autoUpdater } = require('electron-updater');
const remoteMain = require("@electron/remote/main");
let win;
require("electron-reloader")
remoteMain.initialize();
function createWindow() {
win = new BrowserWindow({width: 800, height: 600,webPreferences: {nodeIntegration: true,enableRemoteModule: true,contextIsolation: false}});
remoteMain.enable(win.webContents);
win.loadFile("index.html");
}
app.on('ready', createWindow) ;
autoUpdater.checkForUpdatesAndNotify();
autoUpdater.on('update-available', () => {
mainWindow.webContents.send('update_available');
});
autoUpdater.on('update-downloaded', () => {
mainWindow.webContents.send('update_downloaded');
});
ipcMain.on('restart_app', () => {
autoUpdater.quitAndInstall();
});