diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index df20d5a54..4ab87bea9 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -239,11 +239,17 @@ app.commandLine.appendSwitch('vmodule', 'console=0'); // https://github.com/atom/electron/blob/master/docs/api/auto-updater.md autoUpdater.setFeedURL('http://mycompany.com/myapp/latest?version=' + app.getVersion()); - autoUpdater.checkForUpdates(); - autoUpdater.quitAndInstall(); +autoUpdater.on('error', (error) => { + console.log('error', error); +}); + +autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName, releaseDate, updateURL) => { + console.log('update-downloaded', releaseNotes, releaseName, releaseDate, updateURL); +}); + // browser-window // https://github.com/atom/electron/blob/master/docs/api/browser-window.md diff --git a/github-electron/github-electron.auto-updater.d.ts b/github-electron/github-electron.auto-updater.d.ts index bcb0ca951..48d4e22f4 100644 --- a/github-electron/github-electron.auto-updater.d.ts +++ b/github-electron/github-electron.auto-updater.d.ts @@ -6,8 +6,32 @@ /// declare namespace Electron { - + /** + * This module provides an interface for the Squirrel auto-updater framework. + */ class AutoUpdater extends EventEmitter { + /** + * Emitted when there is an error while updating. + */ + on(event: 'error', listener: (error: Error) => void): this; + /** + * Emitted when checking if an update has started. + */ + on(event: 'checking-for-update', listener: Function): this; + /** + * Emitted when there is an available update. The update is downloaded automatically. + */ + on(event: 'update-available', listener: Function): this; + /** + * Emitted when there is no available update. + */ + on(event: 'update-not-available', listener: Function): this; + /** + * Emitted when an update has been downloaded. + * Note: On Windows only releaseName is available. + */ + on(event: 'update-downloaded', listener: (event: Event, releaseNotes: string, releaseName: string, releaseDate: Date, updateURL: string) => void): this; + on(event: string, listener: Function): this; /** * Set the url and initialize the auto updater. * The url cannot be changed once it is set. @@ -22,6 +46,6 @@ declare namespace Electron { * Restarts the app and installs the update after it has been downloaded. * It should only be called after update-downloaded has been emitted. */ - quitAndInstall(): void; + quitAndInstall(): void; } }