electron updater.Class.RpmUpdater
Electron-Builder / electron-updater / RpmUpdater
继承自¶
构造函数¶
new RpmUpdater()¶
new RpmUpdater(
options
?,app
?):RpmUpdater
参数¶
• 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¶
protected
readonly
app:AppAdapter
继承自¶
autoDownload¶
autoDownload:
boolean
=true
是否在找到更新时自动下载更新。
默认值¶
true
继承自¶
autoInstallOnAppQuit¶
autoInstallOnAppQuit:
boolean
=true
是否在应用程序退出时自动安装已下载的更新(如果之前没有调用 quitAndInstall
)。
默认值¶
true
继承自¶
BaseUpdater
.autoInstallOnAppQuit
autoRunAppAfterInstall¶
autoRunAppAfterInstall:
boolean
=true
当以非静默模式运行安装程序时,是否在安装完成后运行应用程序。
默认值¶
true
继承自¶
BaseUpdater
.autoRunAppAfterInstall
currentVersion¶
readonly
currentVersion:SemVer
当前的应用程序版本。
继承自¶
disableDifferentialDownload¶
disableDifferentialDownload:
boolean
=false
仅 NSIS 禁用差异下载,并始终执行安装程序的完整下载。
默认值¶
false
继承自¶
BaseUpdater
.disableDifferentialDownload
disableWebInstaller¶
disableWebInstaller:
boolean
=false
Web 安装程序文件可能没有签名验证,此开关阻止加载它们,除非需要。
目前为 false 以防止破坏当前 API,但当允许破坏性更改时,应在某个时候将其更改为默认 true。
默认值¶
false
继承自¶
BaseUpdater
.disableWebInstaller
downloadedUpdateHelper¶
protected
downloadedUpdateHelper: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¶
protected
quitAndInstallCalled:boolean
=false
继承自¶
BaseUpdater
.quitAndInstallCalled
requestHeaders¶
requestHeaders:
null
|OutgoingHttpHeaders
=null
请求标头。
继承自¶
signals¶
readonly
signals:UpdaterSignal
为了类型安全,您可以使用 signals,例如 autoUpdater.signals.updateDownloaded(() => {})
而不是 autoUpdater.on('update-available', () => {})
继承自¶
stagingUserIdPromise¶
protected
readonly
stagingUserIdPromise:Lazy
<string
>
继承自¶
BaseUpdater
.stagingUserIdPromise
updateInfoAndProvider¶
protected
updateInfoAndProvider:null
|UpdateInfoAndProvider
=null
继承自¶
BaseUpdater
.updateInfoAndProvider
访问器¶
channel¶
get
channel():null
|string
获取更新渠道。不返回更新配置中的 channel
,仅当之前设置过时才返回。
set
channel(value
):void
设置更新渠道。覆盖更新配置中的 channel
。
allowDowngrade
将自动设置为 true
。如果此行为不适合您,请在之后显式设置 allowDowngrade
。
参数¶
• value: null
| string
返回值¶
null
| string
继承自¶
installerPath¶
get
protected
installerPath():null
|string
返回值¶
null
| string
重写自¶
isUpdateSupported¶
get
isUpdateSupported():VerifyUpdateSupport
允许开发人员覆盖用于确定是否支持更新的默认逻辑。默认逻辑使用 semver
包将 UpdateInfo
的最低系统版本与 os.release()
进行比较
set
isUpdateSupported(value
):void
参数¶
• value: VerifyUpdateSupport
返回值¶
继承自¶
logger¶
get
logger():null
|Logger
日志记录器。您可以传递 electron-log、winston 或另一个具有以下接口的日志记录器:{ info(), warn(), error() }
。如果您想禁用日志记录功能,请将其设置为 null
。
set
logger(value
):void
参数¶
• value: null
| Logger
返回值¶
null
| Logger
继承自¶
netSession¶
get
netSession():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()¶
protected
addQuitHandler():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()¶
protected
differentialDownloadInstaller(fileInfo
,downloadUpdateOptions
,installerPath
,provider
,oldInstallerFileName
):Promise
<boolean
>
参数¶
• fileInfo: ResolvedUpdateFileInfo
• downloadUpdateOptions: DownloadUpdateOptions
• installerPath: string
• provider: Provider
<any
>
• oldInstallerFileName: string
返回值¶
Promise
<boolean
>
继承自¶
BaseUpdater
.differentialDownloadInstaller
dispatchError()¶
protected
dispatchError(e
):void
参数¶
• e: Error
返回值¶
void
继承自¶
dispatchUpdateDownloaded()¶
protected
dispatchUpdateDownloaded(event
):void
参数¶
• event: UpdateDownloadedEvent
返回值¶
void
继承自¶
BaseUpdater
.dispatchUpdateDownloaded
doInstall()¶
protected
doInstall(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()¶
protected
executeDownload(taskOptions
):Promise
<string
[]>
参数¶
• taskOptions: DownloadExecutorTask
返回值¶
Promise
<string
[]>
继承自¶
getFeedURL()¶
getFeedURL():
undefined
|null
|string
返回值¶
undefined
| null
| string
继承自¶
getMaxListeners()¶
getMaxListeners():
number
返回值¶
number
继承自¶
getUpdateInfoAndProvider()¶
protected
getUpdateInfoAndProvider():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()¶
protected
onUpdateAvailable(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-only 以静默模式运行安装程序。默认为 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
,则 GenericServerOptions 将被设置为以该值作为 url
。
参数¶
• options: PublishConfiguration
| AllPublishOptions
如果您想覆盖 app-update.yml
中的配置。
返回值¶
void
继承自¶
setMaxListeners()¶
setMaxListeners(
n
):this
参数¶
• n: number
返回值¶
this
继承自¶
spawnLog()¶
protected
spawnLog(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()¶
protected
spawnSyncLog(cmd
,args
,env
):string
参数¶
• cmd: string
• args: string
[] = []
• env = {}
返回值¶
字符串
继承自¶
wrapSudo()¶
protected
wrapSudo():string
返回值¶
字符串