当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript autoUpdater.on方法代码示例

本文整理汇总了TypeScript中electron-updater.autoUpdater.on方法的典型用法代码示例。如果您正苦于以下问题:TypeScript autoUpdater.on方法的具体用法?TypeScript autoUpdater.on怎么用?TypeScript autoUpdater.on使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在electron-updater.autoUpdater的用法示例。


在下文中一共展示了autoUpdater.on方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: listenForUpdates

	function listenForUpdates() {
		autoUpdater.on('update-available', (updateInfo) => {
			if (!settings.get('autoUpdate')) {
				return;
			}
			showNotification('A new update is ready to download', 
				`Version ${updateInfo.version} is can be downloaded, click to start download`, () => {
					autoUpdater.downloadUpdate();
					setProgress(1);
					autoUpdater.signals.progress((info) => {
						setProgress(info.percent);
					});

					autoUpdater.signals.updateDownloaded((info) => {
						removeProgressBar();

						showNotification('Done downloading update', 
							'Click here to install and relaunch now', () => {
								app.relaunch();
								autoUpdater.quitAndInstall();
							});
					});
				});
		});
	}
开发者ID:SanderRonde,项目名称:youtube-music-app,代码行数:25,代码来源:updater.ts

示例2:

export const runAutoUpdaterService = (window: BrowserWindow) => {
  autoUpdater.on('update-downloaded', ({ version }) => {
    window.webContents.send(UPDATE_AVAILABLE, version);
  });

  ipcMain.on(UPDATE_RESTART_AND_INSTALL, () => {
    autoUpdater.quitAndInstall();
  });

  ipcMain.on(UPDATE_CHECK, () => {
    if (process.env.ENV !== 'dev') {
      autoUpdater.checkForUpdates();
    }
  });
};
开发者ID:laquereric,项目名称:wexond,代码行数:15,代码来源:auto-updater.ts

示例3: constructor

 private constructor() {
     autoUpdater.on('checking-for-update', () => {
         console.log('Checking for update...');
     })
     autoUpdater.on('update-available', (info) => {
         console.log('Update available.');
     })
     autoUpdater.on('update-not-available', (info) => {
         console.log('Update not available.');
     })
     autoUpdater.on('error', (err) => {
         console.log('Error in auto-updater. ' + err);
     })
     autoUpdater.on('download-progress', (progressObj) => {
         let log_message = "Download speed: " + progressObj.bytesPerSecond;
         log_message = log_message + ' - Downloaded ' + progressObj.percent + '%';
         log_message = log_message + ' (' + progressObj.transferred + "/" + progressObj.total + ')';
         console.log(log_message);
     })
     autoUpdater.on('update-downloaded', (info) => {
         console.log('Update downloaded');
     });
 }
开发者ID:jazzkell,项目名称:barcode-to-pc-server,代码行数:23,代码来源:update.handler.ts

示例4: createTrayIcon

// This config makes console (log/info/warn/error - no debug!) output go to breadcrumbs.
ipcMain.on('environment-info', (event: Event, info: {appVersion: string, dsn: string}) => {
  sentry.init({dsn: info.dsn, release: info.appVersion, maxBreadcrumbs: 100});
  // To clearly identify app restarts in Sentry.
  console.info(`Outline is starting`);
});

ipcMain.on('quit-app', quitApp);

ipcMain.on('localizationResponse', (event: Event, localizationResult: {[key: string]: string}) => {
  if (!!localizationResult) {
    localizedStrings = localizationResult;
  }
  createTrayIcon(ConnectionStatus.DISCONNECTED);
});

function checkForUpdates() {
  try {
    autoUpdater.checkForUpdates();
  } catch (e) {
    console.error(`Failed to check for updates`, e);
  }
}

// Notify the UI of updates.
autoUpdater.on('update-downloaded', (ev, info) => {
  if (mainWindow) {
    mainWindow.webContents.send('update-downloaded');
  }
});
开发者ID:hlyu368,项目名称:outline-client,代码行数:30,代码来源:index.ts

示例5: callback

        const appPath = new url.URL(request.url).pathname;
        const filesystemPath = path.join(__dirname, 'server_manager/web_app', appPath);
        callback(filesystemPath);
      },
      (error) => {
        if (error) {
          throw new Error('Failed to register outline protocol');
        }
      });
  mainWindow = createMainWindow();
});

const UPDATE_DOWNLOADED_EVENT = 'update-downloaded';
autoUpdater.on(UPDATE_DOWNLOADED_EVENT, (ev, info) => {
  if (!!mainWindow) {
    mainWindow.webContents.send(UPDATE_DOWNLOADED_EVENT);
  }
});

// Set of fingerprints.  All values are true.
const trustedFingerprints = new Set<string>();

interface IpcEvent {
  returnValue: {};
}

ipcMain.on('whitelist-certificate', (event: IpcEvent, fingerprint: string) => {
  const prefix = 'sha256/';
  const electronFormFingerprint = prefix + fingerprint;
  trustedFingerprints.add(electronFormFingerprint);
  event.returnValue = true;
开发者ID:fang2x,项目名称:outline-server,代码行数:31,代码来源:index.ts


注:本文中的electron-updater.autoUpdater.on方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。