|
1 | | -// import { autoUpdater } from "electron-updater"; |
2 | | -// import log from "electron-log"; |
3 | | - |
4 | | -// export const electronUpdater = win => { |
5 | | -// autoUpdater.logger = log; |
6 | | -// autoUpdater.logger.transports.file.level = "info"; |
7 | | -// log.info("App starting..."); |
8 | | - |
9 | | -// function sendStatusToWindow(text) { |
10 | | -// log.info(text); |
11 | | -// win.webContents.send("autoupdater-message", text); |
12 | | -// } |
13 | | - |
14 | | -// autoUpdater.on("checking-for-update", () => { |
15 | | -// sendStatusToWindow("Checking for update..."); |
16 | | -// }); |
17 | | - |
18 | | -// autoUpdater.on("update-available", info => { |
19 | | -// sendStatusToWindow("Update available."); |
20 | | -// }); |
21 | | - |
22 | | -// autoUpdater.on("update-not-available", info => { |
23 | | -// sendStatusToWindow("Update not available."); |
24 | | -// }); |
25 | | - |
26 | | -// autoUpdater.on("error", err => { |
27 | | -// sendStatusToWindow("Error in auto-updater. " + err); |
28 | | -// }); |
29 | | - |
30 | | -// autoUpdater.on("download-progress", progressObj => { |
31 | | -// const log_message = `Download speed: ${ |
32 | | -// progressObj.bytesPerSecond |
33 | | -// } - Downloaded ${progressObj.percent} % ${log_message} ( ${ |
34 | | -// progressObj.transferred |
35 | | -// } / ${progressObj.total} )`; |
36 | | -// sendStatusToWindow(log_message); |
37 | | -// }); |
38 | | - |
39 | | -// autoUpdater.on("update-downloaded", info => { |
40 | | -// sendStatusToWindow("Update downloaded"); |
41 | | -// }); |
42 | | -// }; |
| 1 | +import { autoUpdater } from "electron-updater"; |
| 2 | +import log from "electron-log"; |
| 3 | + |
| 4 | +export class AppUpdater { |
| 5 | + constructor() { |
| 6 | + const log = require("electron-log"); |
| 7 | + log.transports.file.level = "info"; |
| 8 | + autoUpdater.logger = log; |
| 9 | + autoUpdater.checkForUpdatesAndNotify(); |
| 10 | + } |
| 11 | +} |
0 commit comments