refactor: 1

pull/192/head
xiaojunnuo 2021-08-27 17:32:10 +08:00
parent 06c1fb0340
commit 542c5952a5
2 changed files with 10 additions and 6 deletions

View File

@ -82,7 +82,7 @@ function doMerge (defObj, newObj) {
} }
let timer let timer
const configApi = { const configApi = {
startAutoDownloadRemoteConfig () { async startAutoDownloadRemoteConfig () {
if (timer != null) { if (timer != null) {
clearInterval(timer) clearInterval(timer)
} }
@ -90,7 +90,7 @@ const configApi = {
await configApi.downloadRemoteConfig() await configApi.downloadRemoteConfig()
configApi.reload() configApi.reload()
} }
download() await download()
setInterval(download, 24 * 60 * 60 * 1000) // 1天 setInterval(download, 24 * 60 * 60 * 1000) // 1天
}, },
downloadRemoteConfig () { downloadRemoteConfig () {

View File

@ -124,6 +124,13 @@ function invoke (api, param) {
return ret return ret
} }
async function doStart () {
// 开启自动下载远程配置
await DevSidecar.api.config.startAutoDownloadRemoteConfig()
// 启动所有
localApi.startup()
}
export default { export default {
install ({ win }) { install ({ win }) {
// 接收view的方法调用 // 接收view的方法调用
@ -150,10 +157,7 @@ export default {
// 合并用户配置 // 合并用户配置
DevSidecar.api.config.reload() DevSidecar.api.config.reload()
// 开启自动下载远程配置 doStart()
DevSidecar.api.config.startAutoDownloadRemoteConfig()
// 启动所有
localApi.startup()
}, },
devSidecar: DevSidecar, devSidecar: DevSidecar,
invoke invoke