本文整理匯總了TypeScript中electron.autoUpdater.checkForUpdates方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript autoUpdater.checkForUpdates方法的具體用法?TypeScript autoUpdater.checkForUpdates怎麽用?TypeScript autoUpdater.checkForUpdates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron.autoUpdater
的用法示例。
在下文中一共展示了autoUpdater.checkForUpdates方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getServerUrl
server.listen(0, '127.0.0.1', () => {
serverUrl = getServerUrl(server);
autoUpdater.on('error', (error: Error) => {
logger.error('autoUpdater: error', getPrintableError(error));
reject(error);
});
autoUpdater.on('update-downloaded', () => {
logger.info('autoUpdater: update-downloaded event fired');
shutdown(server, logger);
resolve();
});
autoUpdater.setFeedURL({
url: serverUrl,
headers: { 'Cache-Control': 'no-cache' },
});
autoUpdater.checkForUpdates();
});
示例2: setupAutoUpdater
function setupAutoUpdater():void {
// Don't even attempt to write the auto update unless we are on a system that supports it.
// Which as of the time of this comment only is windows.
if (!canAutoupdate()) return;
autoUpdater.addListener("update-available", function () {
win.webContents.send("update-info", "UPDATE.AVAILABLE");
});
autoUpdater.addListener("update-downloaded", function () {
win.webContents.send("update-info", "UPDATE.DOWNLOADED");
});
autoUpdater.addListener("error", function (error:any) {
console.log(error);
win.webContents.send("update-error", error);
});
autoUpdater.addListener("checking-for-update", function () {
win.webContents.send("update-info", "UPDATE.CHECKING_FOR_UPDATE");
});
autoUpdater.addListener("update-not-available", function () {
win.webContents.send("update-info", "UPDATE.NOT_AVAILABLE");
});
var feedUrl:string = "";
if (platform() == "win32") {
feedUrl = "http://zlepper.dk:3215/update/win";
if (arch() == "x64") {
console.log("64x windows detected.");
feedUrl += "64"
} else {
feedUrl += "32"
}
}
feedUrl += "/" + app.getVersion();
// The feed url was not set for some reason, so we'll not attempt to get any update package.
if (feedUrl == "") {
return;
}
autoUpdater.setFeedURL(feedUrl);
autoUpdater.checkForUpdates();
}
示例3:
ipcMain.on("brackets-app-ready", () => {
autoUpdater.checkForUpdates();
});
示例4:
window.webContents.once("did-frame-finish-load", (event: any) => {
autoUpdater.checkForUpdates()
})