electron updater.Class.PacmanUpdater
Electron-Builder / electron-updater / PacmanUpdater
继承自¶
构造函数¶
new PacmanUpdater()¶
new PacmanUpdater(
options?,app?):PacmanUpdater
参数¶
• options?: null | AllPublishOptions
• app?: AppAdapter
返回值¶
覆盖¶
属性¶
_isUpdateSupported¶
protected_isUpdateSupported:VerifyUpdateSupport
继承自¶
BaseUpdater._isUpdateSupported
_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
继承自¶
BaseUpdater.autoInstallOnAppQuit
autoRunAppAfterInstall¶
autoRunAppAfterInstall:
boolean=true
当在非静默模式下运行安装程序时,是否在完成安装后运行应用程序。
默认¶
true
继承自¶
BaseUpdater.autoRunAppAfterInstall
currentVersion¶
readonlycurrentVersion:SemVer
当前应用程序版本。
继承自¶
disableDifferentialDownload¶
disableDifferentialDownload:
boolean=false
仅限 NSIS 禁用差异下载并始终执行安装程序的完整下载。
默认¶
false
继承自¶
BaseUpdater.disableDifferentialDownload
disableWebInstaller¶
disableWebInstaller:
boolean=false
Web 安装程序文件可能没有签名验证,此开关可防止加载它们,除非需要。
当前为 false 以防止破坏当前的 API,但它应该在允许破坏性更改的某个时间点更改为默认 true。
默认¶
false
继承自¶
BaseUpdater.disableWebInstaller
downloadedUpdateHelper¶
protecteddownloadedUpdateHelper:null|DownloadedUpdateHelper=null
继承自¶
BaseUpdater.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
继承自¶
BaseUpdater.forceDevUpdateConfig
fullChangelog¶
fullChangelog:
boolean=false
仅 GitHub 提供程序。 获取所有发行说明(从当前版本到最新版本),而不仅仅是最新的。
默认¶
false
继承自¶
quitAndInstallCalled¶
protectedquitAndInstallCalled:boolean=false
继承自¶
BaseUpdater.quitAndInstallCalled
requestHeaders¶
requestHeaders:
null|OutgoingHttpHeaders=null
请求标头。
继承自¶
signals¶
readonlysignals:UpdaterSignal
为了类型安全,您可以使用 signals,例如 autoUpdater.signals.updateDownloaded(() => {}) 而不是 autoUpdater.on('update-available', () => {})
继承自¶
stagingUserIdPromise¶
protectedreadonlystagingUserIdPromise:Lazy<string>
继承自¶
BaseUpdater.stagingUserIdPromise
updateInfoAndProvider¶
protectedupdateInfoAndProvider:null|UpdateInfoAndProvider=null
继承自¶
BaseUpdater.updateInfoAndProvider
访问器¶
channel¶
getchannel():null|string
获取更新频道。不从更新配置返回 channel,仅当先前设置时才返回。
setchannel(value):void
设置更新频道。覆盖更新配置中的 channel。
allowDowngrade 将自动设置为 true。如果此行为不适合您,只需在之后显式设置 allowDowngrade 即可。
参数¶
• value: null | string
返回值¶
null | string
继承自¶
installerPath¶
getprotectedinstallerPath():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
继承自¶
addQuitHandler()¶
protectedaddQuitHandler():void
返回值¶
void
继承自¶
checkForUpdates()¶
checkForUpdates():
Promise<null|UpdateCheckResult>
询问服务器是否有更新。
返回值¶
Promise<null | UpdateCheckResult>
如果更新程序被禁用,则为 null,否则为有关最新版本的信息
继承自¶
checkForUpdatesAndNotify()¶
checkForUpdatesAndNotify(
downloadNotification?):Promise<null|UpdateCheckResult>
参数¶
• downloadNotification?: DownloadNotification
返回值¶
Promise<null | UpdateCheckResult>
继承自¶
BaseUpdater.checkForUpdatesAndNotify
differentialDownloadInstaller()¶
protecteddifferentialDownloadInstaller(fileInfo,downloadUpdateOptions,installerPath,provider,oldInstallerFileName):Promise<boolean>
参数¶
• fileInfo: ResolvedUpdateFileInfo
• downloadUpdateOptions: DownloadUpdateOptions
• installerPath: string
• provider: Provider<any>
• oldInstallerFileName: string
返回值¶
Promise<boolean>
继承自¶
BaseUpdater.differentialDownloadInstaller
dispatchError()¶
protecteddispatchError(e):void
参数¶
• e: Error
返回值¶
void
继承自¶
dispatchUpdateDownloaded()¶
protecteddispatchUpdateDownloaded(event):void
参数¶
• event: UpdateDownloadedEvent
返回值¶
void
继承自¶
BaseUpdater.dispatchUpdateDownloaded
doInstall()¶
protecteddoInstall(options):boolean
参数¶
• options: InstallOptions
返回值¶
boolean
覆盖¶
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>
继承自¶
BaseUpdater.getUpdateInfoAndProvider
install()¶
install(
isSilent,isForceRunAfter):boolean
参数¶
• isSilent: boolean = false
• isForceRunAfter: boolean = false
返回值¶
boolean
继承自¶
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
继承自¶
BaseUpdater。prependOnceListener
quitAndInstall()¶
quitAndInstall(
isSilent,isForceRunAfter):void
在下载更新后,重启应用并安装更新。它应该只在 update-downloaded 事件发出后被调用。
注意: autoUpdater.quitAndInstall() 会首先关闭所有应用程序窗口,然后才在 app 上发出 before-quit 事件。这与正常的退出事件顺序不同。
参数¶
• isSilent: boolean = false
仅限 Windows 以静默模式运行安装程序。默认为 false。
• isForceRunAfter: boolean = false
即使在静默安装后也运行应用程序。不适用于 macOS。如果 isSilent 设置为 false 则忽略(在这种情况下,您仍然可以设置 autoRunAppAfterInstall 为 false 以防止在完成后运行应用程序)。
返回¶
void
继承自¶
rawListeners()¶
rawListeners<
U>(type):AppUpdaterEvents[U][]
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• type: U
返回¶
AppUpdaterEvents[U][]
继承自¶
removeAllListeners()¶
removeAllListeners(
event?):this
参数¶
• event?: keyof AppUpdaterEvents
返回¶
this
继承自¶
BaseUpdater。removeAllListeners
removeListener()¶
removeListener<
U>(event,listener):this
类型参数¶
• U extends keyof AppUpdaterEvents
参数¶
• event: U
• listener: AppUpdaterEvents[U]
返回¶
this
继承自¶
setFeedURL()¶
setFeedURL(
options):void
配置更新提供程序。如果值为 string,则将使用该值作为 url 设置 GenericServerOptions。
参数¶
• options: PublishConfiguration | AllPublishOptions
如果您想覆盖 app-update.yml 中的配置。
返回¶
void
继承自¶
setMaxListeners()¶
setMaxListeners(
n):this
参数¶
• n: number
返回¶
this
继承自¶
spawnLog()¶
protectedspawnLog(cmd,args,env,stdio):Promise<boolean>
这处理了 node 8 和 node 10 在衍生进程时发出错误的方式 - node 8:抛出错误 - node 10:发出错误(需要使用 on 监听)。
参数¶
• cmd: string
• args: string[] = []
• env: any = undefined
• stdio: StdioOptions = "ignore"
返回¶
Promise<boolean>
继承自¶
spawnSyncLog()¶
protectedspawnSyncLog(cmd,args,env):string
参数¶
• cmd: string
• args: string[] = []
• env = {}
返回¶
string
继承自¶
wrapSudo()¶
protectedwrapSudo():string
返回¶
string