electron updater.Class.MacUpdater
Electron-Builder / electron-updater / MacUpdater
继承自¶
构造函数¶
new MacUpdater()¶
new MacUpdater(
options?,app?):MacUpdater
参数¶
• options?: AllPublishOptions
• app?: AppAdapter
返回值¶
覆盖¶
属性¶
_isUpdateSupported¶
protected_isUpdateSupported:VerifyUpdateSupport
继承自¶
_logger¶
protected_logger:Logger=console
继承自¶
allowDowngrade¶
allowDowngrade:
boolean=false
是否允许版本降级(当用户从 beta 频道想要回到稳定频道时)。
仅当频道不同时才会被考虑(语义版本控制中的预发布版本组件)。
默认值¶
false
继承自¶
allowPrerelease¶
allowPrerelease:
boolean=false
仅 GitHub 提供程序。 是否允许更新到预发布版本。如果应用程序版本包含预发布组件(例如 0.12.1-alpha.1,此处 alpha 是预发布组件),则默认为 true,否则为 false。
如果为 true,则允许降级(allowDowngrade 将设置为 true)。
继承自¶
app¶
protectedreadonlyapp:AppAdapter
继承自¶
autoDownload¶
autoDownload:
boolean=true
是否在找到更新时自动下载更新。
默认值¶
true
继承自¶
autoInstallOnAppQuit¶
autoInstallOnAppQuit:
boolean=true
是否在应用程序退出时自动安装下载的更新(如果之前没有调用 quitAndInstall)。
默认值¶
true
继承自¶
AppUpdater.autoInstallOnAppQuit
autoRunAppAfterInstall¶
autoRunAppAfterInstall:
boolean=true
当运行安装程序未处于静默模式时,是否在安装完成后运行应用程序。
默认值¶
true
继承自¶
AppUpdater.autoRunAppAfterInstall
currentVersion¶
readonlycurrentVersion:SemVer
当前应用程序版本。
继承自¶
disableDifferentialDownload¶
disableDifferentialDownload:
boolean=false
仅 NSIS 禁用差异下载并始终执行安装程序的完整下载。
默认值¶
false
继承自¶
AppUpdater.disableDifferentialDownload
disableWebInstaller¶
disableWebInstaller:
boolean=false
Web 安装程序文件可能没有签名验证,此开关阻止加载它们,除非需要。
目前为 false,以防止破坏当前的 API,但在允许破坏性更改的某个时候,应将其更改为默认 true。
默认值¶
false
继承自¶
AppUpdater.disableWebInstaller
downloadedUpdateHelper¶
protecteddownloadedUpdateHelper:null|DownloadedUpdateHelper=null
继承自¶
AppUpdater.downloadedUpdateHelper
forceDevUpdateConfig¶
forceDevUpdateConfig:
boolean=false
允许开发人员强制更新程序在“dev”模式下工作,查找“dev-app-update.yml”而不是“app-update.yml”。开发环境:path.join(this.app.getAppPath(), "dev-app-update.yml") 生产环境:path.join(process.resourcesPath!, "app-update.yml")
默认值¶
false
继承自¶
AppUpdater.forceDevUpdateConfig
fullChangelog¶
fullChangelog:
boolean=false
仅 GitHub 提供程序。 获取所有发行说明(从当前版本到最新版本),而不仅仅是最新的。
默认值¶
false
继承自¶
requestHeaders¶
requestHeaders:
null|OutgoingHttpHeaders=null
请求标头。
继承自¶
signals¶
readonlysignals:UpdaterSignal
为了类型安全,您可以使用信号,例如 autoUpdater.signals.updateDownloaded(() => {}) 而不是 autoUpdater.on('update-available', () => {})
继承自¶
stagingUserIdPromise¶
protectedreadonlystagingUserIdPromise:Lazy<string>
继承自¶
AppUpdater.stagingUserIdPromise
updateInfoAndProvider¶
protectedupdateInfoAndProvider:null|UpdateInfoAndProvider=null
继承自¶
AppUpdater.updateInfoAndProvider
访问器¶
channel¶
getchannel():null|string
获取更新频道。不返回更新配置中的 channel,仅当之前设置过时才返回。
setchannel(value):void
设置更新频道。覆盖更新配置中的 channel。
allowDowngrade 将自动设置为 true。如果此行为不适合您,请在此之后简单地显式设置 allowDowngrade。
参数¶
• value: null | string
返回值¶
null | string
继承自¶
isUpdateSupported¶
getisUpdateSupported():VerifyUpdateSupport
允许开发人员覆盖用于确定是否支持更新的默认逻辑。默认逻辑将 UpdateInfo 的最低系统版本与使用 semver 包的 os.release() 进行比较
setisUpdateSupported(value):void
参数¶
• value: VerifyUpdateSupport
返回值¶
继承自¶
logger¶
getlogger():null|Logger
记录器。您可以传递 electron-log、winston 或另一个具有以下接口的记录器:{ info(), warn(), error() }。如果您想禁用日志记录功能,请将其设置为 null。
setlogger(value):void
参数¶
• value: null | Logger
返回值¶
null | Logger
继承自¶
netSession¶
getnetSession():Session
返回值¶
Session
继承自¶
方法¶
addAuthHeader()¶
addAuthHeader(
token):void
显式向请求标头添加身份验证令牌的快捷方式
参数¶
• token: string
返回值¶
void
继承自¶
addListener()¶
addListener<
U>(event,listener):this
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• event: U
• listener: AppUpdaterEvents[U]
返回值¶
this
继承自¶
checkForUpdates()¶
checkForUpdates():
Promise<null|UpdateCheckResult>
询问服务器是否有更新。
返回值¶
Promise<null | UpdateCheckResult>
如果更新程序被禁用,则为 null,否则为关于最新版本的信息
继承自¶
checkForUpdatesAndNotify()¶
checkForUpdatesAndNotify(
downloadNotification?):Promise<null|UpdateCheckResult>
参数¶
• downloadNotification?: DownloadNotification
返回值¶
Promise<null | UpdateCheckResult>
继承自¶
AppUpdater.checkForUpdatesAndNotify
differentialDownloadInstaller()¶
protecteddifferentialDownloadInstaller(fileInfo,downloadUpdateOptions,installerPath,provider,oldInstallerFileName):Promise<boolean>
参数¶
• fileInfo: ResolvedUpdateFileInfo
• downloadUpdateOptions: DownloadUpdateOptions
• installerPath: string
• provider: Provider<any>
• oldInstallerFileName: string
返回值¶
Promise<boolean>
继承自¶
AppUpdater.differentialDownloadInstaller
dispatchError()¶
protecteddispatchError(e):void
参数¶
• e: Error
返回值¶
void
继承自¶
dispatchUpdateDownloaded()¶
protecteddispatchUpdateDownloaded(event):void
参数¶
• event: UpdateDownloadedEvent
返回值¶
void
继承自¶
AppUpdater.dispatchUpdateDownloaded
doDownloadUpdate()¶
protecteddoDownloadUpdate(downloadUpdateOptions):Promise<string[]>
参数¶
• downloadUpdateOptions: DownloadUpdateOptions
返回值¶
Promise<string[]>
覆盖¶
downloadUpdate()¶
downloadUpdate(
cancellationToken):Promise<string[]>
开始手动下载更新。如果 autoDownload 选项设置为 false,您可以使用此方法。
参数¶
• cancellationToken: CancellationToken = ...
返回值¶
Promise<string[]>
下载文件的路径。
继承自¶
emit()¶
emit<
U>(event, …args):boolean
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• event: U
• …args: Parameters<AppUpdaterEvents[U]>
返回值¶
boolean
继承自¶
eventNames()¶
eventNames<
U>():U[]
类型参数¶
• U extends keyof AppUpdaterEvents
返回值¶
U[]
继承自¶
executeDownload()¶
protectedexecuteDownload(taskOptions):Promise<string[]>
参数¶
• taskOptions: DownloadExecutorTask
返回值¶
Promise<string[]>
继承自¶
getFeedURL()¶
getFeedURL():
undefined|null|string
返回值¶
undefined | null | string
继承自¶
getMaxListeners()¶
getMaxListeners():
number
返回值¶
number
继承自¶
getUpdateInfoAndProvider()¶
protectedgetUpdateInfoAndProvider():Promise<UpdateInfoAndProvider>
返回值¶
Promise<UpdateInfoAndProvider>
继承自¶
AppUpdater.getUpdateInfoAndProvider
isUpdaterActive()¶
isUpdaterActive():
boolean
返回值¶
boolean
继承自¶
listenerCount()¶
listenerCount(
type):number
参数¶
• type: keyof AppUpdaterEvents
返回值¶
number
继承自¶
listeners()¶
listeners<
U>(type):AppUpdaterEvents[U][]
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• type: U
返回值¶
AppUpdaterEvents[U][]
继承自¶
off()¶
off<
U>(event,listener):this
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• event: U
• listener: AppUpdaterEvents[U]
返回值¶
this
继承自¶
on()¶
on<
U>(event,listener):this
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• event: U
• listener: AppUpdaterEvents[U]
返回值¶
this
继承自¶
once()¶
once<
U>(event,listener):this
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• event: U
• listener: AppUpdaterEvents[U]
返回值¶
this
继承自¶
onUpdateAvailable()¶
protectedonUpdateAvailable(updateInfo):void
参数¶
• updateInfo: UpdateInfo
返回值¶
void
继承自¶
prependListener()¶
prependListener<
U>(event,listener):this
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• event: U
• listener: AppUpdaterEvents[U]
返回值¶
this
继承自¶
prependOnceListener()¶
prependOnceListener<
U>(event,listener):this
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• event: U
• listener: AppUpdaterEvents[U]
返回值¶
this
继承自¶
AppUpdater.prependOnceListener
quitAndInstall()¶
quitAndInstall():
void
重启应用并安装已下载的更新。它应该只在 update-downloaded 事件发出后被调用。
注意: autoUpdater.quitAndInstall() 将首先关闭所有应用程序窗口,然后才在 app 上发出 before-quit 事件。这与正常的退出事件序列不同。
返回值¶
void
覆盖¶
rawListeners()¶
rawListeners<
U>(type):AppUpdaterEvents[U][]
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• type: U
返回值¶
AppUpdaterEvents[U][]
继承自¶
removeAllListeners()¶
removeAllListeners(
event?):this
参数¶
• event?: keyof AppUpdaterEvents
返回值¶
this
继承自¶
removeListener()¶
removeListener<
U>(event,listener):this
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• event: U
• listener: AppUpdaterEvents[U]
返回值¶
this
继承自¶
setFeedURL()¶
setFeedURL(
options):void
配置更新提供器。如果值为 string,则 GenericServerOptions 将被设置为以该值作为 url。
参数¶
• options: PublishConfiguration | AllPublishOptions
如果你想覆盖 app-update.yml 中的配置。
返回值¶
void
继承自¶
setMaxListeners()¶
setMaxListeners(
n):this
参数¶
• n: number
返回值¶
this