|
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("message", text); |
12 | | - } |
13 | | - |
14 | | - autoUpdater.on("checking-for-update", () => { |
15 | | - sendStatusToWindow("Checking for update..."); |
16 | | - }); |
17 | | - autoUpdater.on("update-available", info => { |
18 | | - sendStatusToWindow("Update available."); |
19 | | - }); |
20 | | - autoUpdater.on("update-not-available", info => { |
21 | | - sendStatusToWindow("Update not available."); |
22 | | - }); |
23 | | - autoUpdater.on("error", err => { |
24 | | - sendStatusToWindow("Error in auto-updater. " + err); |
25 | | - }); |
26 | | - autoUpdater.on("download-progress", progressObj => { |
27 | | - let log_message = "Download speed: " + progressObj.bytesPerSecond; |
28 | | - log_message = log_message + " - Downloaded " + progressObj.percent + "%"; |
29 | | - log_message = |
30 | | - log_message + |
31 | | - " (" + |
32 | | - progressObj.transferred + |
33 | | - "/" + |
34 | | - progressObj.total + |
35 | | - ")"; |
36 | | - sendStatusToWindow(log_message); |
37 | | - }); |
38 | | - autoUpdater.on("update-downloaded", info => { |
39 | | - sendStatusToWindow("Update downloaded"); |
40 | | - }); |
41 | | -}; |
| 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 | +// }; |
0 commit comments