electron#autoUpdater JavaScript Examples

The following examples show how to use electron#autoUpdater. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoUpdater.js    From makerverse with GNU General Public License v3.0 6 votes vote down vote up
constructor(window) {
        if (process.platform !== 'darwin') {
            return;
        }

        autoUpdater.addListener('update-available', (event) => {
            log.debug('A new update is available');
        });
        // On Windows only `releaseName` is available.
        autoUpdater.addListener('update-downloaded', (event, releaseNotes, releaseName, releaseDate, updateURL) => {
            const title = 'A new update is ready to install';
            const message = `Version ${releaseName} is downloaded and will be automatically installed on quit`;
            notify(title, message);
        });
        autoUpdater.addListener('error', (err) => {
            log.error(err);
        });
        autoUpdater.addListener('checking-for-update', () => {
            log.debug('checking-for-update');
        });
        autoUpdater.addListener('update-not-available', () => {
            log.debug('update-not-available');
        });

        const updateServerHost = ''; // FIXME
        const platform = os.platform();
        const arch = os.arch();
        const version = app.getVersion();
        const feedURL = `https://${updateServerHost}/update/${platform}-${arch}/${version}`;
        autoUpdater.setFeedURL(feedURL);

        window.webContents.once('did-frame-finish-load', (event) => {
            autoUpdater.checkForUpdates();
        });
    }