| | |
| | | * |
| | | * |
| | | */ |
| | | Object.defineProperty(app, 'isPackaged', { |
| | | get() { |
| | | return true; |
| | | } |
| | | }); |
| | | |
| | | // 单例锁 |
| | | const gotTheLock = app.requestSingleInstanceLock() |
| | |
| | | } |
| | | if (cb && 'function' == typeof cb) { |
| | | win.once('ready-to-show', () => { |
| | | log.info('900') |
| | | cb(win.webContents); |
| | | }) |
| | | } |
| | | |
| | | // 自动检测更新 软件的第一个实例打开后 为了不影响加载速度 在指定时间后做一次自检 |
| | | win.once('ready-to-show', () => { |
| | | log.info('ready event'); |
| | | // TODO |
| | | setTimeout(() => { |
| | | update(win.webContents, true); |
| | | }, 1000 * 10); |
| | | }); |
| | | |
| | | win.webContents.session.on('will-download', (e, item) => { |
| | | // const filePath = path.join(saveUrl, item.getFilename()); |
| | |
| | | update(event.sender); |
| | | }); |
| | | |
| | | ipcMain.on('download-update', () => { |
| | | autoUpdater.downloadUpdate(); |
| | | }); |
| | | |
| | | ipcMain.on('quitAndInstall', () => { |
| | | autoUpdater.quitAndInstall(); |
| | | }); |