本文整理匯總了TypeScript中electron-updater.AppUpdater.checkForUpdates方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AppUpdater.checkForUpdates方法的具體用法?TypeScript AppUpdater.checkForUpdates怎麽用?TypeScript AppUpdater.checkForUpdates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron-updater.AppUpdater
的用法示例。
在下文中一共展示了AppUpdater.checkForUpdates方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: validateDownload
export async function validateDownload(updater: AppUpdater, expectDownloadPromise = true) {
tuneNsisUpdater(updater)
const actualEvents = trackEvents(updater)
const updateCheckResult = await updater.checkForUpdates()
const assets = (updateCheckResult.updateInfo as any).assets
if (assets != null) {
for (const asset of assets) {
delete asset.download_count
}
}
expect(updateCheckResult.updateInfo).toMatchSnapshot()
if (expectDownloadPromise) {
expect(updateCheckResult.downloadPromise).toBeDefined()
const downloadResult = await updateCheckResult.downloadPromise
if (updater instanceof MacUpdater) {
expect(downloadResult).toEqual([])
}
else {
await assertThat(path.join((downloadResult)!![0])).isFile()
}
}
else {
expect(updateCheckResult.downloadPromise).toBeUndefined()
}
expect(actualEvents).toMatchSnapshot()
return updateCheckResult
}
示例2: constructor
constructor(
private electronService: ElectronService,
private dialogService: DialogService
) {
// Conditional imports
if (this.electronService.isElectron()) {
// enable autoUpdater for production builds only
if (AppConfig.production) {
this.autoUpdater = this.electronService.remote.getGlobal('autoUpdater');
this.autoUpdater.autoDownload = false;
this.bindUpdaterEvents();
this.autoUpdater.checkForUpdates(); // TODO: re-check in certain intervals
}
}
}
示例3: validateDownload
export async function validateDownload(updater: AppUpdater, expectDownloadPromise = true) {
tuneNsisUpdater(updater)
const actualEvents = trackEvents(updater)
const updateCheckResult = await updater.checkForUpdates()
expect(updateCheckResult.fileInfo).toMatchSnapshot()
if (expectDownloadPromise) {
if (updater instanceof MacUpdater) {
expect(await updateCheckResult.downloadPromise).toEqual([])
}
else {
await assertThat(path.join((await updateCheckResult.downloadPromise)!![0])).isFile()
}
}
else {
expect(updateCheckResult.downloadPromise).toBeUndefined()
}
expect(actualEvents).toMatchSnapshot()
return updateCheckResult
}