11import { EventEmitter } from 'events'
22import { BrowserWindow , app } from 'electron'
3+ import { autoUpdater } from 'electron-updater'
34const isProduction = process . env . NODE_ENV === 'production'
45
56export default class BrowserWinHandler {
@@ -19,8 +20,33 @@ export default class BrowserWinHandler {
1920 // This method will be called when Electron has finished
2021 // initialization and is ready to create browser windows.
2122 // Some APIs can only be used after this event occurs.
23+ autoUpdater . on ( 'checking-for-update' , ( ) => {
24+ console . log ( "1" )
25+ } )
26+ autoUpdater . on ( 'update-available' , ( ev , info ) => {
27+ console . log ( "2" )
28+ } )
29+ autoUpdater . on ( 'update-not-available' , ( ev , info ) => {
30+ console . log ( "3" )
31+ } )
32+ autoUpdater . on ( 'error' , ( ev , err ) => {
33+ console . log ( "4" )
34+ } )
35+ autoUpdater . on ( 'download-progress' , ( ev , progressObj ) => {
36+ console . log ( "5" )
37+ } )
38+ autoUpdater . on ( 'update-downloaded' , ( ev , info ) => {
39+ // Wait 5 seconds, then quit and install
40+ // In your application, you don't need to wait 5 seconds.
41+ // You could call autoUpdater.quitAndInstall(); immediately
42+ console . log ( "6" )
43+ autoUpdater . quitAndInstall ( ) ;
44+ } )
45+
2246 app . on ( 'ready' , ( ) => {
2347 this . _create ( )
48+ console . log ( "0" )
49+ autoUpdater . checkForUpdates ( )
2450 } )
2551
2652 // On macOS it's common to re-create a window in the app when the
0 commit comments