mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Update auto-updater module
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
+26
-2
@@ -6,8 +6,32 @@
|
||||
/// <reference path="github-electron.event-emitter.d.ts" />
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user